typetext
{
"aspect_ratio": "match_input_image",
"image_input": [
"data:image/jpeg;base64,..."
],
"output_format": "png",
"prompt": "Non-contrast axial head CT, brain window, adult after a fall: acute epidural hematoma over the right convexity - biconvex hyperdense extra-axial collection with a few hypodense swirls, mild local mass effect with effacement of sulci and slight compression of the adjacent ventricle, overlying scalp swelling. Ordinary clinical CT reconstruction exported as a screenshot. Use the attached image ONLY as a reference for the acquisition: the same kind of device or camera, the same lighting, color cast, white balance, contrast, sharpness, depth of field, sensor/film noise, compression, framing distance and background type. It must be a DIFFERENT patient and an independently composed image: do not copy the reference's exact lesion shape, layout or anatomy. Unretouched, unremarkable real-world clinical image with ordinary imperfections. No captions, arrows, rulers, watermarks or annotations.",
"resolution": "2K"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_bLp**********************************
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: "match_input_image",
image_input: ["data:image/jpeg;base64,..."],
output_format: "png",
prompt: "Non-contrast axial head CT, brain window, adult after a fall: acute epidural hematoma over the right convexity - biconvex hyperdense extra-axial collection with a few hypodense swirls, mild local mass effect with effacement of sulci and slight compression of the adjacent ventricle, overlying scalp swelling. Ordinary clinical CT reconstruction exported as a screenshot. Use the attached image ONLY as a reference for the acquisition: the same kind of device or camera, the same lighting, color cast, white balance, contrast, sharpness, depth of field, sensor/film noise, compression, framing distance and background type. It must be a DIFFERENT patient and an independently composed image: do not copy the reference's exact lesion shape, layout or anatomy. Unretouched, unremarkable real-world clinical image with ordinary imperfections. No captions, arrows, rulers, watermarks or annotations.",
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_bLp**********************************
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": "match_input_image",
"image_input": ["data:image/jpeg;base64,..."],
"output_format": "png",
"prompt": "Non-contrast axial head CT, brain window, adult after a fall: acute epidural hematoma over the right convexity - biconvex hyperdense extra-axial collection with a few hypodense swirls, mild local mass effect with effacement of sulci and slight compression of the adjacent ventricle, overlying scalp swelling. Ordinary clinical CT reconstruction exported as a screenshot. Use the attached image ONLY as a reference for the acquisition: the same kind of device or camera, the same lighting, color cast, white balance, contrast, sharpness, depth of field, sensor/film noise, compression, framing distance and background type. It must be a DIFFERENT patient and an independently composed image: do not copy the reference's exact lesion shape, layout or anatomy. Unretouched, unremarkable real-world clinical image with ordinary imperfections. No captions, arrows, rulers, watermarks or annotations.",
"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_bLp**********************************
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": "match_input_image",
"image_input": ["data:image/jpeg;base64,..."],
"output_format": "png",
"prompt": "Non-contrast axial head CT, brain window, adult after a fall: acute epidural hematoma over the right convexity - biconvex hyperdense extra-axial collection with a few hypodense swirls, mild local mass effect with effacement of sulci and slight compression of the adjacent ventricle, overlying scalp swelling. Ordinary clinical CT reconstruction exported as a screenshot. Use the attached image ONLY as a reference for the acquisition: the same kind of device or camera, the same lighting, color cast, white balance, contrast, sharpness, depth of field, sensor/film noise, compression, framing distance and background type. It must be a DIFFERENT patient and an independently composed image: do not copy the reference\'s exact lesion shape, layout or anatomy. Unretouched, unremarkable real-world clinical image with ordinary imperfections. No captions, arrows, rulers, watermarks or annotations.",
"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": "jkc9838tysrmt0d1syma39q444",
"model": "google/nano-banana-2.1",
"version": "hidden",
"input": {
"aspect_ratio": "match_input_image",
"image_input": [
"data:image/jpeg;base64,..."
],
"output_format": "png",
"prompt": "Non-contrast axial head CT, brain window, adult after a fall: acute epidural hematoma over the right convexity - biconvex hyperdense extra-axial collection with a few hypodense swirls, mild local mass effect with effacement of sulci and slight compression of the adjacent ventricle, overlying scalp swelling. Ordinary clinical CT reconstruction exported as a screenshot. Use the attached image ONLY as a reference for the acquisition: the same kind of device or camera, the same lighting, color cast, white balance, contrast, sharpness, depth of field, sensor/film noise, compression, framing distance and background type. It must be a DIFFERENT patient and an independently composed image: do not copy the reference's exact lesion shape, layout or anatomy. Unretouched, unremarkable real-world clinical image with ordinary imperfections. No captions, arrows, rulers, watermarks or annotations.",
"resolution": "2K"
},
"logs": "Matched input image aspect ratio 1.12 to 1:1\nNo sid\nGenerating image with Gemini Flash...\nTokens: 4327\nGenerated image in 21.42 seconds",
"output": "https://replicate.delivery/xezq/UkL7OqBZnEIoL16zhpotUtKSOa93m3ApfRsFe6PgK8Bk41gXA/tmpv2xom9vw.png",
"data_removed": false,
"error": null,
"source": "api",
"status": "succeeded",
"created_at": "2026-11-12T12:07:43.094Z",
"started_at": "2026-11-12T12:07:43.111147Z",
"completed_at": "2026-11-12T12:08:06.41044Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/jkc9838tysrmt0d1syma39q444/cancel",
"get": "https://api.replicate.com/v1/predictions/jkc9838tysrmt0d1syma39q444",
"stream": "https://stream.replicate.com/v1/files/jbxs-acj5tza6sn6xxwa6wh3o6jxnhyftwr3lzrqjcohckvtrgyp6xunq",
"web": "https://replicate.com/p/jkc9838tysrmt0d1syma39q444"
},
"metrics": {
"image_output_count": 1,
"predict_time": 23.299293155,
"resolution_target": "2K",
"total_time": 23.316440914
}
}