typetext
{
"aspect_ratio": "auto",
"duration": 5,
"image": "https://replicate.delivery/pbxt/PCRhFZ9wvsy2oylrpkZqa9VyAhDfe7VQi0jOKERQF6tX2ddF/download-4.png",
"prompt": "Cinematic motion - the woman looks up out into the sunlight filtering into the room. ",
"resolution": "720p"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Hyu**********************************
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 xai/grok-imagine-video-1.5 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
aspect_ratio: "auto",
duration: 5,
image: "https://replicate.delivery/pbxt/PCRhFZ9wvsy2oylrpkZqa9VyAhDfe7VQi0jOKERQF6tX2ddF/download-4.png",
prompt: "Cinematic motion - the woman looks up out into the sunlight filtering into the room. ",
resolution: "720p"
};
const output = await replicate.run("xai/grok-imagine-video-1.5", { 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_Hyu**********************************
This is your API token. Keep it to yourself.
import replicate
Run xai/grok-imagine-video-1.5 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"xai/grok-imagine-video-1.5",
input={
"aspect_ratio": "auto",
"duration": 5,
"image": "https://replicate.delivery/pbxt/PCRhFZ9wvsy2oylrpkZqa9VyAhDfe7VQi0jOKERQF6tX2ddF/download-4.png",
"prompt": "Cinematic motion - the woman looks up out into the sunlight filtering into the room. ",
"resolution": "720p"
}
)
# 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_Hyu**********************************
This is your API token. Keep it to yourself.
Run xai/grok-imagine-video-1.5 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": "auto",
"duration": 5,
"image": "https://replicate.delivery/pbxt/PCRhFZ9wvsy2oylrpkZqa9VyAhDfe7VQi0jOKERQF6tX2ddF/download-4.png",
"prompt": "Cinematic motion - the woman looks up out into the sunlight filtering into the room. ",
"resolution": "720p"
}
}' \
https://api.replicate.com/v1/models/xai/grok-imagine-video-1.5/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "9mk1zz7zz1rmr0cygc992hfnjw",
"model": "xai/grok-imagine-video-1.5",
"version": "hidden",
"input": {
"aspect_ratio": "auto",
"duration": 5,
"image": "https://replicate.delivery/pbxt/PCRhFZ9wvsy2oylrpkZqa9VyAhDfe7VQi0jOKERQF6tX2ddF/download-4.png",
"prompt": "Cinematic motion - the woman looks up out into the sunlight filtering into the room. ",
"resolution": "720p"
},
"logs": "Video generation submitted with request_id: 9c1ec448-5b30-92a9-870e-81b8cad2d7e4\nFirst poll response: {\"status\": \"done\", \"video\": {\"url\": \"https://vidgen.x.ai/xai-vidgen-bucket/xai-video-73069583-c5d0-4e5c-ac32-a608297f287f.mp4\", \"duration\": 5, \"respect_moderation\": true}, \"model\": \"grok-imagine-video-1.5-preview\", \"usage\": {\"cost_in_usd_ticks\": 7100000000}, \"progress\": 100}\nVideo generation completed in 30.7sec\nDownloading 1673058 bytes\nDownloaded 1.60MB in 0.28sec\nOutput video duration: 5.04 seconds",
"output": "https://replicate.delivery/xezq/cBByL2g8a8YsMlnC3PtjRZrveiDH3Xe6iOoIWYTdzhXhekVtA/tmp1s0k1idu.mp4",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2026-06-01T12:05:21.016Z",
"started_at": "2026-06-01T12:05:21.097077Z",
"completed_at": "2026-06-01T12:05:53.662363Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/9mk1zz7zz1rmr0cygc992hfnjw/cancel",
"get": "https://api.replicate.com/v1/predictions/9mk1zz7zz1rmr0cygc992hfnjw",
"stream": "https://stream.replicate.com/v1/files/jbxs-jg5seeqxbytfa2vwv7aplgt45achwdn5epm4tmifsjwsdmwjyxiq",
"web": "https://replicate.com/p/9mk1zz7zz1rmr0cygc992hfnjw"
},
"metrics": {
"predict_time": 32.565285994999996,
"total_time": 32.646363686,
"video_output_duration_seconds": 5.042
}
}