typetext
{
"aspect_ratio": "4:3",
"prompt": "a close up photo of @woman and @friend lounging on the sofa in @living_room, it is evening and low light",
"reference_images": [
"https://replicate.delivery/pbxt/NGEXyNlRyT6OFrrscxAae4lLm6PJTOKjjvYTrfJljtUuQdVL/0_1%20copy.jpg",
"https://replicate.delivery/pbxt/NGEjBFBUKPjuDeiOhCsQTFPUnAC1cElJClWuyit8hPmSIZPo/out-0-1.webp",
"https://replicate.delivery/pbxt/NJkc6nEP7g1NiDHF7v4n8xn64qbJe9VH4zZ8kfh5HsBEqwQe/jennai.webp"
],
"reference_tags": [
"woman",
"living_room",
"friend"
],
"resolution": "1080p"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Dda**********************************
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: "4:3",
prompt: "a close up photo of @woman and @friend lounging on the sofa in @living_room, it is evening and low light",
reference_images: ["https://replicate.delivery/pbxt/NGEXyNlRyT6OFrrscxAae4lLm6PJTOKjjvYTrfJljtUuQdVL/0_1%20copy.jpg","https://replicate.delivery/pbxt/NGEjBFBUKPjuDeiOhCsQTFPUnAC1cElJClWuyit8hPmSIZPo/out-0-1.webp","https://replicate.delivery/pbxt/NJkc6nEP7g1NiDHF7v4n8xn64qbJe9VH4zZ8kfh5HsBEqwQe/jennai.webp"],
reference_tags: ["woman","living_room","friend"],
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_Dda**********************************
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": "4:3",
"prompt": "a close up photo of @woman and @friend lounging on the sofa in @living_room, it is evening and low light",
"reference_images": ["https://replicate.delivery/pbxt/NGEXyNlRyT6OFrrscxAae4lLm6PJTOKjjvYTrfJljtUuQdVL/0_1%20copy.jpg","https://replicate.delivery/pbxt/NGEjBFBUKPjuDeiOhCsQTFPUnAC1cElJClWuyit8hPmSIZPo/out-0-1.webp","https://replicate.delivery/pbxt/NJkc6nEP7g1NiDHF7v4n8xn64qbJe9VH4zZ8kfh5HsBEqwQe/jennai.webp"],
"reference_tags": ["woman","living_room","friend"],
"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_Dda**********************************
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": "4:3",
"prompt": "a close up photo of @woman and @friend lounging on the sofa in @living_room, it is evening and low light",
"reference_images": ["https://replicate.delivery/pbxt/NGEXyNlRyT6OFrrscxAae4lLm6PJTOKjjvYTrfJljtUuQdVL/0_1%20copy.jpg","https://replicate.delivery/pbxt/NGEjBFBUKPjuDeiOhCsQTFPUnAC1cElJClWuyit8hPmSIZPo/out-0-1.webp","https://replicate.delivery/pbxt/NJkc6nEP7g1NiDHF7v4n8xn64qbJe9VH4zZ8kfh5HsBEqwQe/jennai.webp"],
"reference_tags": ["woman","living_room","friend"],
"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": "w794379qssrm80cqwr2rpaapsc",
"model": "runwayml/gen4-image",
"version": "hidden",
"input": {
"aspect_ratio": "4:3",
"prompt": "a close up photo of @woman and @friend lounging on the sofa in @living_room, it is evening and low light",
"reference_images": [
"https://replicate.delivery/pbxt/NGEXyNlRyT6OFrrscxAae4lLm6PJTOKjjvYTrfJljtUuQdVL/0_1%20copy.jpg",
"https://replicate.delivery/pbxt/NGEjBFBUKPjuDeiOhCsQTFPUnAC1cElJClWuyit8hPmSIZPo/out-0-1.webp",
"https://replicate.delivery/pbxt/NJkc6nEP7g1NiDHF7v4n8xn64qbJe9VH4zZ8kfh5HsBEqwQe/jennai.webp"
],
"reference_tags": [
"woman",
"living_room",
"friend"
],
"resolution": "1080p"
},
"logs": "Using seed: 2071868060\nUsing reference tags: woman, living_room, friend\nGenerating image with ratio 1440:1080 (4:3 at 1080p resolution)\nGenerating...\n0%\n5%\n20%\n41%\n61%\n81%\nGenerated image in 35.0sec\nDownloading 1752384 bytes\nDownloaded 1.67MB in 0.12sec",
"output": "https://replicate.delivery/xezq/hmdYjFMgZeyUXC6ISvzfD5OP4E6Gmj5swTBTlxqDRlfUd38pA/tmpohfv3t88.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-07-07T17:53:11.118Z",
"started_at": "2025-07-07T17:53:11.128651Z",
"completed_at": "2025-07-07T17:53:46.849692Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/w794379qssrm80cqwr2rpaapsc/cancel",
"get": "https://api.replicate.com/v1/predictions/w794379qssrm80cqwr2rpaapsc",
"stream": "https://stream.replicate.com/v1/files/bcwr-nv7uk7mv5ev5utsjbmkmumlydg3u5wz5m6upc6ijn4lm327p6mla",
"web": "https://replicate.com/p/w794379qssrm80cqwr2rpaapsc"
},
"metrics": {
"predict_time": 35.721040372,
"total_time": 35.731692
}
}


