typetext
{
"aspect_ratio": "match_input_image",
"image_input": [
"https://replicate.delivery/pbxt/NtNvPPT9zaBPywFSnPidtdYjYfmmhFnX9qAbuUlVhqqAy7r8/replicate-prediction-rqnshtcwy1rme0csxbtrfftnf0.webp",
"https://replicate.delivery/pbxt/NtNvPNax6WzKPzw61mHbJfV6FMZ9JHtIlgCA2GxQr4mmJHTw/TotK_Pirate_Ship.png"
],
"output_format": "jpg",
"prompt": "change the sketch into a rendered image of pirates driving a ship during a daylight storm. Use the same vibrant color style as the second image"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_dLl**********************************
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 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
aspect_ratio: "match_input_image",
image_input: ["https://replicate.delivery/pbxt/NtNvPPT9zaBPywFSnPidtdYjYfmmhFnX9qAbuUlVhqqAy7r8/replicate-prediction-rqnshtcwy1rme0csxbtrfftnf0.webp","https://replicate.delivery/pbxt/NtNvPNax6WzKPzw61mHbJfV6FMZ9JHtIlgCA2GxQr4mmJHTw/TotK_Pirate_Ship.png"],
output_format: "jpg",
prompt: "change the sketch into a rendered image of pirates driving a ship during a daylight storm. Use the same vibrant color style as the second image"
};
const output = await replicate.run("google/nano-banana", { 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_dLl**********************************
This is your API token. Keep it to yourself.
import replicate
Run google/nano-banana using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"google/nano-banana",
input={
"aspect_ratio": "match_input_image",
"image_input": ["https://replicate.delivery/pbxt/NtNvPPT9zaBPywFSnPidtdYjYfmmhFnX9qAbuUlVhqqAy7r8/replicate-prediction-rqnshtcwy1rme0csxbtrfftnf0.webp","https://replicate.delivery/pbxt/NtNvPNax6WzKPzw61mHbJfV6FMZ9JHtIlgCA2GxQr4mmJHTw/TotK_Pirate_Ship.png"],
"output_format": "jpg",
"prompt": "change the sketch into a rendered image of pirates driving a ship during a daylight storm. Use the same vibrant color style as the second image"
}
)
# 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_dLl**********************************
This is your API token. Keep it to yourself.
Run google/nano-banana 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": "match_input_image",
"image_input": ["https://replicate.delivery/pbxt/NtNvPPT9zaBPywFSnPidtdYjYfmmhFnX9qAbuUlVhqqAy7r8/replicate-prediction-rqnshtcwy1rme0csxbtrfftnf0.webp","https://replicate.delivery/pbxt/NtNvPNax6WzKPzw61mHbJfV6FMZ9JHtIlgCA2GxQr4mmJHTw/TotK_Pirate_Ship.png"],
"output_format": "jpg",
"prompt": "change the sketch into a rendered image of pirates driving a ship during a daylight storm. Use the same vibrant color style as the second image"
}
}' \
https://api.replicate.com/v1/models/google/nano-banana/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "jdj4f4t9exrma0csxc1tw2y0dw",
"model": "google/nano-banana",
"version": "hidden",
"input": {
"aspect_ratio": "match_input_image",
"image_input": [
"https://replicate.delivery/pbxt/NtNvPPT9zaBPywFSnPidtdYjYfmmhFnX9qAbuUlVhqqAy7r8/replicate-prediction-rqnshtcwy1rme0csxbtrfftnf0.webp",
"https://replicate.delivery/pbxt/NtNvPNax6WzKPzw61mHbJfV6FMZ9JHtIlgCA2GxQr4mmJHTw/TotK_Pirate_Ship.png"
],
"output_format": "jpg",
"prompt": "change the sketch into a rendered image of pirates driving a ship during a daylight storm. Use the same vibrant color style as the second image"
},
"logs": "Generating image with Gemini Flash...\nGenerated image in 9.74 seconds",
"output": "https://replicate.delivery/xezq/txHBIe8GZoUqP692aLb78NYSfC1mPfeKPjfGYTafuvIyLV4XF/tmpya2346kr.jpeg",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-10-16T03:14:45.239Z",
"started_at": "2025-10-16T03:14:45.396473Z",
"completed_at": "2025-10-16T03:14:55.306681Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/jdj4f4t9exrma0csxc1tw2y0dw/cancel",
"get": "https://api.replicate.com/v1/predictions/jdj4f4t9exrma0csxc1tw2y0dw",
"stream": "https://stream.replicate.com/v1/files/bcwr-iz7eyjkfbqi2fea64roqlxndm6g7ti4jbdkongssah3x5cc6ilnq",
"web": "https://replicate.com/p/jdj4f4t9exrma0csxc1tw2y0dw"
},
"metrics": {
"predict_time": 9.910208258,
"total_time": 10.067681
}
}

