typetext
{
"chain_length": 3,
"check_dialogue": true,
"initial_prompt": "a news presenter gets confused during a broadcast",
"use_fast_model": false
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_adV**********************************
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 fofr/chained-video using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
chain_length: 3,
check_dialogue: true,
initial_prompt: "a news presenter gets confused during a broadcast",
use_fast_model: false
};
const output = await replicate.run("fofr/chained-video", { 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_adV**********************************
This is your API token. Keep it to yourself.
import replicate
Run fofr/chained-video using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"fofr/chained-video",
input={
"chain_length": 3,
"check_dialogue": True,
"initial_prompt": "a news presenter gets confused during a broadcast",
"use_fast_model": False
}
)
# 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_adV**********************************
This is your API token. Keep it to yourself.
Run fofr/chained-video 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": {
"chain_length": 3,
"check_dialogue": true,
"initial_prompt": "a news presenter gets confused during a broadcast",
"use_fast_model": false
}
}' \
https://api.replicate.com/v1/models/fofr/chained-video/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "hn7jxfzhjxrma0crg3hvak37tg",
"model": "fofr/chained-video",
"version": "hidden",
"input": {
"chain_length": 3,
"check_dialogue": true,
"initial_prompt": "a news presenter gets confused during a broadcast",
"use_fast_model": false
},
"logs": "Using Veo-3-fast for video generation\nGenerating initial video with prompt: a news presenter gets confused during a broadcast\n=== Generating video 2 of 3 ===\nExtracting last frame...\nVideo path: /tmp/e5c1b3d9867fa3d1/tmp1utwsd9h.mp4\nVideo path type: <class 'replicate.use.URLPath'>\nResolved video path: /tmp/e5c1b3d9867fa3d1/tmp1utwsd9h.mp4\nVideo file exists, size: 1665811 bytes\nGetting total frame count...\nTotal frames: 192, extracting frame index: 191\nExtracting exact last frame to /tmp/tmp27eqe6ir.jpg...\nFrame extraction completed successfully\nffmpeg stdout: \nffmpeg stderr: ffmpeg version 5.1.6-0+deb12u1 Copyright (c) 2000-2024 the FFmpeg developers\n built with gcc 12 (Debian 12.2.0-14)\n configuration: --prefix=/usr --extra-version=0+deb12u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared\n libavutil 57. 28.100 / 57. 28.100\n libavcodec 59. 37.100 / 59. 37.100\n libavformat 59. 27.100 / 59. 27.100\n libavdevice 59. 7.100 / 59. 7.100\n libavfilter 8. 44.100 / 8. 44.100\n libswscale 6. 7.100 / 6. 7.100\n libswresample 4. 7.100 / 4. 7.100\n libpostproc 56. 6.100 / 56. 6.100\n-vsync is deprecated. Use -fps_mode\nPassing a number to -vsync is deprecated, use a string argument as described in the manual.\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/e5c1b3d9867fa3d1/tmp1utwsd9h.mp4':\n Metadata:\n major_brand : isom\n minor_version : 512\n compatible_brands: isomiso2avc1mp41\n encoder : Google\n Duration: 00:00:08.00, start: 0.000000, bitrate: 1665 kb/s\n Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1280x720, 1404 kb/s, 24 fps, 24 tbr, 12288 tbn (default)\n Metadata:\n handler_name : VideoHandler\n vendor_id : [0][0][0][0]\n Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 255 kb/s (default)\n Metadata:\n handler_name : SoundHandler\n vendor_id : [0][0][0][0]\nStream mapping:\n Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))\nOutput #0, image2, to '/tmp/tmp27eqe6ir.jpg':\n Metadata:\n major_brand : isom\n minor_version : 512\n compatible_brands: isomiso2avc1mp41\n encoder : Lavf59.27.100\n Stream #0:0(und): Video: mjpeg, yuvj420p(pc, progressive), 1280x720, q=2-31, 200 kb/s, 24 fps, 24 tbn (default)\n Metadata:\n handler_name : VideoHandler\n vendor_id : [0][0][0][0]\n encoder : Lavc59.37.100 mjpeg\n Side data:\n cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A\nframe= 1 fps=0.0 q=2.0 size=N/A time=00:00:08.00 bitrate=N/A speed=21.3x \nframe= 1 fps=0.0 q=2.0 Lsize=N/A time=00:00:08.00 bitrate=N/A speed= 21x \nvideo:44kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown\n\nLast frame extracted to: /tmp/tmp27eqe6ir.jpg\nChecking for dialogue in video...\nTranscribing audio from video: /tmp/e5c1b3d9867fa3d1/tmp1utwsd9h.mp4\nTranscription result: Good evening. Tonight's top story is, well, it seems I've misplaced my notes.\nFound dialogue: Good evening. Tonight's top story is, well, it seems I've misplaced my notes.\nCalling Claude for next prompt with visual context...\nClaude generated prompt: A news presenter in a navy blue suit and red tie sits at a white news desk, looking increasingly flustered as he searches through papers scattered across the desk surface. The studio lighting remains consistent with warm professional broadcast lighting against the grey and blue background. He glances nervously at the camera then back down at his desk, shuffling through the papers with visible confusion. His professional composure begins to crack as he realizes the extent of his predicament. He looks back up at the camera with a forced smile and says: \"Bear with me folks, this is live television after all.\"\nCalling Veo-3-fast for next video...\nGenerated video 2: /tmp/eb7dc1cb7913790a/tmpzf094xpp.mp4\nTotal videos so far: 2\n=== Generating video 3 of 3 ===\nExtracting last frame...\nVideo path: /tmp/eb7dc1cb7913790a/tmpzf094xpp.mp4\nVideo path type: <class 'replicate.use.URLPath'>\nResolved video path: /tmp/eb7dc1cb7913790a/tmpzf094xpp.mp4\nVideo file exists, size: 1763749 bytes\nGetting total frame count...\nTotal frames: 192, extracting frame index: 191\nExtracting exact last frame to /tmp/tmph41qp9e4.jpg...\nFrame extraction completed successfully\nffmpeg stdout: \nffmpeg stderr: ffmpeg version 5.1.6-0+deb12u1 Copyright (c) 2000-2024 the FFmpeg developers\n built with gcc 12 (Debian 12.2.0-14)\n configuration: --prefix=/usr --extra-version=0+deb12u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared\n libavutil 57. 28.100 / 57. 28.100\n libavcodec 59. 37.100 / 59. 37.100\n libavformat 59. 27.100 / 59. 27.100\n libavdevice 59. 7.100 / 59. 7.100\n libavfilter 8. 44.100 / 8. 44.100\n libswscale 6. 7.100 / 6. 7.100\n libswresample 4. 7.100 / 4. 7.100\n libpostproc 56. 6.100 / 56. 6.100\n-vsync is deprecated. Use -fps_mode\nPassing a number to -vsync is deprecated, use a string argument as described in the manual.\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/eb7dc1cb7913790a/tmpzf094xpp.mp4':\n Metadata:\n major_brand : isom\n minor_version : 512\n compatible_brands: isomiso2avc1mp41\n encoder : Google\n Duration: 00:00:08.00, start: 0.000000, bitrate: 1763 kb/s\n Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1280x720, 1502 kb/s, 24 fps, 24 tbr, 12288 tbn (default)\n Metadata:\n handler_name : VideoHandler\n vendor_id : [0][0][0][0]\n Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 255 kb/s (default)\n Metadata:\n handler_name : SoundHandler\n vendor_id : [0][0][0][0]\nStream mapping:\n Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))\nOutput #0, image2, to '/tmp/tmph41qp9e4.jpg':\n Metadata:\n major_brand : isom\n minor_version : 512\n compatible_brands: isomiso2avc1mp41\n encoder : Lavf59.27.100\n Stream #0:0(und): Video: mjpeg, yuvj420p(pc, progressive), 1280x720, q=2-31, 200 kb/s, 24 fps, 24 tbn (default)\n Metadata:\n handler_name : VideoHandler\n vendor_id : [0][0][0][0]\n encoder : Lavc59.37.100 mjpeg\n Side data:\n cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A\nframe= 1 fps=0.0 q=2.0 size=N/A time=00:00:08.00 bitrate=N/A speed=20.2x \nframe= 1 fps=0.0 q=2.0 Lsize=N/A time=00:00:08.00 bitrate=N/A speed=19.9x \nvideo:50kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown\n\nLast frame extracted to: /tmp/tmph41qp9e4.jpg\nChecking for dialogue in video...\nTranscribing audio from video: /tmp/eb7dc1cb7913790a/tmpzf094xpp.mp4\nTranscription result: Bear with me, folks. This is live television after all.\nFound dialogue: Bear with me, folks. This is live television after all.\nCalling Claude for next prompt with visual context...\nClaude generated prompt: The news presenter maintains his forced smile for a moment longer before it falters completely. He takes a deep breath, straightens his red tie, and looks directly into the camera with newfound determination. The studio lighting catches a bead of sweat on his forehead as he places both hands flat on the white desk, pushing aside the scattered papers. His expression shifts from flustered confusion to professional resolve as he leans slightly forward toward the camera. The grey and blue studio background remains consistent as he clears his throat and says with renewed confidence: \"You know what? Let's just wing it tonight.\"\nCalling Veo-3-fast for next video...\nGenerated video 3: /tmp/e6b991dab1bba44e/tmpn_g0i13e.mp4\nTotal videos so far: 3\n=== FINAL: Generated 3 total videos ===\nCombining 3 videos into single output\nCombining 3 videos...",
"output": "https://replicate.delivery/xezq/DS4ji3TvJD5aAJRxXRR3JVtDVzWPfXttFIVwVKJDlFblELkKA/combined_video.mp4",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-08-06T19:37:58.935Z",
"started_at": "2025-08-06T19:37:59.76798Z",
"completed_at": "2025-08-06T19:43:06.884384Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/hn7jxfzhjxrma0crg3hvak37tg/cancel",
"children": "https://api.replicate.com/v1/predictions/hn7jxfzhjxrma0crg3hvak37tg/children",
"get": "https://api.replicate.com/v1/predictions/hn7jxfzhjxrma0crg3hvak37tg",
"root": "https://api.replicate.com/v1/predictions/hn7jxfzhjxrma0crg3hvak37tg",
"stream": "https://stream.replicate.com/v1/files/bcwr-qiapu5dnd4pkhpo2l25nbdh6lwyhdj3tcxrdqwnp2p672nhcmfba",
"web": "https://replicate.com/p/hn7jxfzhjxrma0crg3hvak37tg"
},
"metrics": {
"predict_time": 307.116403344,
"total_time": 307.949384
}
}