typetext
{
"aspect_ratio": "16:9",
"prompt": "show me the man from @img_1 framed through the windshield of a car like the reference @img_2",
"reference_images": [
"https://replicate.delivery/pbxt/NHYyvX67znxq0fgkyHGxk3fKDxGEeyeZspv2Ovx8mA1I6rh3/cinematic-man.jpg",
"https://replicate.delivery/pbxt/NHYyw0KqhQ2tMipLTN20atatluUV7uWwyMEJ1bFksVY2fUVR/car-drawing.jpg"
],
"reference_tags": [
"img_1",
"img_2"
],
"resolution": "1080p"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_IXS**********************************
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 runwayml/gen4-image using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
aspect_ratio: "16:9",
prompt: "show me the man from @img_1 framed through the windshield of a car like the reference @img_2",
reference_images: ["https://replicate.delivery/pbxt/NHYyvX67znxq0fgkyHGxk3fKDxGEeyeZspv2Ovx8mA1I6rh3/cinematic-man.jpg","https://replicate.delivery/pbxt/NHYyw0KqhQ2tMipLTN20atatluUV7uWwyMEJ1bFksVY2fUVR/car-drawing.jpg"],
reference_tags: ["img_1","img_2"],
resolution: "1080p"
};
const output = await replicate.run("runwayml/gen4-image", { 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_IXS**********************************
This is your API token. Keep it to yourself.
import replicate
Run runwayml/gen4-image using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"runwayml/gen4-image",
input={
"aspect_ratio": "16:9",
"prompt": "show me the man from @img_1 framed through the windshield of a car like the reference @img_2",
"reference_images": ["https://replicate.delivery/pbxt/NHYyvX67znxq0fgkyHGxk3fKDxGEeyeZspv2Ovx8mA1I6rh3/cinematic-man.jpg","https://replicate.delivery/pbxt/NHYyw0KqhQ2tMipLTN20atatluUV7uWwyMEJ1bFksVY2fUVR/car-drawing.jpg"],
"reference_tags": ["img_1","img_2"],
"resolution": "1080p"
}
)
# 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_IXS**********************************
This is your API token. Keep it to yourself.
Run runwayml/gen4-image 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": "show me the man from @img_1 framed through the windshield of a car like the reference @img_2",
"reference_images": ["https://replicate.delivery/pbxt/NHYyvX67znxq0fgkyHGxk3fKDxGEeyeZspv2Ovx8mA1I6rh3/cinematic-man.jpg","https://replicate.delivery/pbxt/NHYyw0KqhQ2tMipLTN20atatluUV7uWwyMEJ1bFksVY2fUVR/car-drawing.jpg"],
"reference_tags": ["img_1","img_2"],
"resolution": "1080p"
}
}' \
https://api.replicate.com/v1/models/runwayml/gen4-image/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "bba1vn9dhnrme0cqrs99bzd3t0",
"model": "runwayml/gen4-image",
"version": "hidden",
"input": {
"aspect_ratio": "16:9",
"prompt": "show me the man from @img_1 framed through the windshield of a car like the reference @img_2",
"reference_images": [
"https://replicate.delivery/pbxt/NHYyvX67znxq0fgkyHGxk3fKDxGEeyeZspv2Ovx8mA1I6rh3/cinematic-man.jpg",
"https://replicate.delivery/pbxt/NHYyw0KqhQ2tMipLTN20atatluUV7uWwyMEJ1bFksVY2fUVR/car-drawing.jpg"
],
"reference_tags": [
"img_1",
"img_2"
],
"resolution": "1080p"
},
"logs": "Using seed: 629416602\nUsing reference tags: img_1, img_2\nGenerating image with ratio 1920:1080 (16:9 at 1080p resolution)\nGenerating...\n0%\n23%\n47%\n72%\nGenerated image in 30.1sec\nDownloading 1452079 bytes\nDownloaded 1.38MB in 0.10sec",
"output": "https://replicate.delivery/xezq/aKMWaeA0bXWtS6yFfpzW0ofdkrG3swebPp0fReBVF7UlMeMeUA/tmpk0k5infk.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-07-01T14:09:23.853Z",
"started_at": "2025-07-01T14:09:23.855109Z",
"completed_at": "2025-07-01T14:09:54.504696Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/bba1vn9dhnrme0cqrs99bzd3t0/cancel",
"get": "https://api.replicate.com/v1/predictions/bba1vn9dhnrme0cqrs99bzd3t0",
"stream": "https://stream.replicate.com/v1/files/bcwr-bhhh2gbugurp5s265rqtihs2mujwtpamadfj2w3a7gvv5kol6nxq",
"web": "https://replicate.com/p/bba1vn9dhnrme0cqrs99bzd3t0"
},
"metrics": {
"predict_time": 30.649586901,
"total_time": 30.651696
}
}

