typetext
{
"duration": 5,
"mode": "standard",
"negative_prompt": "",
"prompt": "slow motion, the five slow motion pirates run around the deck during a massive swell, and struggle to keep balance the slow motion boat operating during a slow motion swell. Slow motion. Vibrant. 5 pirates only.",
"start_image": "https://replicate.delivery/pbxt/NtZoiu3v06Tj0I51Y752pNvghmPyAqHYGVulWj8hgupXZKzA/replicate-prediction-2n6h9ke4s9rmc0csxpaag876tm%20%281%29.jpeg"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Xfx**********************************
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 kwaivgi/kling-v2.1 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
duration: 5,
mode: "standard",
negative_prompt: "",
prompt: "slow motion, the five slow motion pirates run around the deck during a massive swell, and struggle to keep balance the slow motion boat operating during a slow motion swell. Slow motion. Vibrant. 5 pirates only.",
start_image: "https://replicate.delivery/pbxt/NtZoiu3v06Tj0I51Y752pNvghmPyAqHYGVulWj8hgupXZKzA/replicate-prediction-2n6h9ke4s9rmc0csxpaag876tm%20%281%29.jpeg"
};
const output = await replicate.run("kwaivgi/kling-v2.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_Xfx**********************************
This is your API token. Keep it to yourself.
import replicate
Run kwaivgi/kling-v2.1 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"kwaivgi/kling-v2.1",
input={
"duration": 5,
"mode": "standard",
"negative_prompt": "",
"prompt": "slow motion, the five slow motion pirates run around the deck during a massive swell, and struggle to keep balance the slow motion boat operating during a slow motion swell. Slow motion. Vibrant. 5 pirates only.",
"start_image": "https://replicate.delivery/pbxt/NtZoiu3v06Tj0I51Y752pNvghmPyAqHYGVulWj8hgupXZKzA/replicate-prediction-2n6h9ke4s9rmc0csxpaag876tm%20%281%29.jpeg"
}
)
# 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_Xfx**********************************
This is your API token. Keep it to yourself.
Run kwaivgi/kling-v2.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": {
"duration": 5,
"mode": "standard",
"negative_prompt": "",
"prompt": "slow motion, the five slow motion pirates run around the deck during a massive swell, and struggle to keep balance the slow motion boat operating during a slow motion swell. Slow motion. Vibrant. 5 pirates only.",
"start_image": "https://replicate.delivery/pbxt/NtZoiu3v06Tj0I51Y752pNvghmPyAqHYGVulWj8hgupXZKzA/replicate-prediction-2n6h9ke4s9rmc0csxpaag876tm%20%281%29.jpeg"
}
}' \
https://api.replicate.com/v1/models/kwaivgi/kling-v2.1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "0sx8wdxdw1rmc0csxq5vh2q6m0",
"model": "kwaivgi/kling-v2.1",
"version": "hidden",
"input": {
"duration": 5,
"mode": "standard",
"negative_prompt": "",
"prompt": "slow motion, the five slow motion pirates run around the deck during a massive swell, and struggle to keep balance the slow motion boat operating during a slow motion swell. Slow motion. Vibrant. 5 pirates only.",
"start_image": "https://replicate.delivery/pbxt/NtZoiu3v06Tj0I51Y752pNvghmPyAqHYGVulWj8hgupXZKzA/replicate-prediction-2n6h9ke4s9rmc0csxpaag876tm%20%281%29.jpeg"
},
"logs": "Using model: kling-v2-1 in std mode\nGenerating video...\nGenerated video in 122.6sec\nGenerated video ID: 807834088521465912\nDownloading 8790954 bytes\nDownloaded 8.38MB in 0.65sec",
"output": "https://replicate.delivery/xezq/F3x4zXxwGBa7EhFVxyIyOpFD71E4eX45Mz7fVSlkSyeAgZfVB/tmpd_udtoev.mp4",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-10-16T16:12:52.576Z",
"started_at": "2025-10-16T16:12:52.584825Z",
"completed_at": "2025-10-16T16:14:56.329347Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/0sx8wdxdw1rmc0csxq5vh2q6m0/cancel",
"get": "https://api.replicate.com/v1/predictions/0sx8wdxdw1rmc0csxq5vh2q6m0",
"stream": "https://stream.replicate.com/v1/files/bcwr-5xlf5gx24kxxvxqxavatl5mghbyfhygsnwtphztsipfp3nicfafa",
"web": "https://replicate.com/p/0sx8wdxdw1rmc0csxq5vh2q6m0"
},
"metrics": {
"predict_time": 123.744521173,
"total_time": 123.753347
}
}