typetext
{
"aspect_ratio": "1:1",
"frames_per_second": 16,
"num_colors": 16,
"num_frames": 81,
"prompt": "a tree in a forest",
"resolution": "480p",
"video_prompt": "the tree is struck by lightning and breaks"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_5jY**********************************
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 erbridge/dithercam using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
aspect_ratio: "1:1",
frames_per_second: 16,
num_colors: 16,
num_frames: 81,
prompt: "a tree in a forest",
resolution: "480p",
video_prompt: "the tree is struck by lightning and breaks"
};
const output = await replicate.run("erbridge/dithercam", { 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_5jY**********************************
This is your API token. Keep it to yourself.
import replicate
Run erbridge/dithercam using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"erbridge/dithercam",
input={
"aspect_ratio": "1:1",
"frames_per_second": 16,
"num_colors": 16,
"num_frames": 81,
"prompt": "a tree in a forest",
"resolution": "480p",
"video_prompt": "the tree is struck by lightning and breaks"
}
)
# 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_5jY**********************************
This is your API token. Keep it to yourself.
Run erbridge/dithercam 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": "1:1",
"frames_per_second": 16,
"num_colors": 16,
"num_frames": 81,
"prompt": "a tree in a forest",
"resolution": "480p",
"video_prompt": "the tree is struck by lightning and breaks"
}
}' \
https://api.replicate.com/v1/models/erbridge/dithercam/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "a36dvzq8x1rma0crntartqg5jw",
"model": "erbridge/dithercam",
"version": "hidden",
"input": {
"aspect_ratio": "1:1",
"frames_per_second": 16,
"num_colors": 16,
"num_frames": 81,
"prompt": "a tree in a forest",
"resolution": "480p",
"video_prompt": "the tree is struck by lightning and breaks"
},
"logs": "ffmpeg version 7.1.1 Copyright (c) 2000-2025 the FFmpeg developers\n built with gcc 13.2.1 (Alpine 13.2.1_git20240309) 20240309\n configuration: --pkg-config-flags=--static --extra-cflags=-fopenmp --extra-ldflags='-fopenmp -Wl,--allow-multiple-definition -Wl,-z,stack-size=2097152' --toolchain=hardened --disable-debug --disable-shared --disable-ffplay --enable-static --enable-gpl --enable-version3 --enable-fontconfig --enable-gray --enable-iconv --enable-lcms2 --enable-libaom --enable-libaribb24 --enable-libass --enable-libbluray --enable-libdav1d --enable-libdavs2 --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libjxl --enable-libkvazaar --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librabbitmq --enable-librav1e --enable-librsvg --enable-librtmp --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libuavs3d --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libvvenc --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxevd --enable-libxeve --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-openssl\n libavutil 59. 39.100 / 59. 39.100\n libavcodec 61. 19.101 / 61. 19.101\n libavformat 61. 7.100 / 61. 7.100\n libavdevice 61. 3.100 / 61. 3.100\n libavfilter 10. 4.100 / 10. 4.100\n libswscale 8. 3.100 / 8. 3.100\n libswresample 5. 3.100 / 5. 3.100\n libpostproc 58. 3.100 / 58. 3.100\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/cog-runner-tmp-1950730513/958d4e1360524efe/tmp1lzj8ezb.mp4':\n Metadata:\n major_brand : isom\n minor_version : 512\n compatible_brands: isomiso2avc1mp41\n encoder : Lavf60.16.100\n Duration: 00:00:05.04, start: 0.000000, bitrate: 4912 kb/s\n Stream #0:0[0x1](und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(progressive), 640x640, 4910 kb/s, 24 fps, 24 tbr, 12288 tbn (default)\n Metadata:\n handler_name : VideoHandler\n vendor_id : [0][0][0][0]\nStream mapping:\n Stream #0:0 -> #0:0 (h264 (native) -> png (native))\nPress [q] to stop, [?] for help\nOutput #0, image2, to '/tmp/frames/frame_%04d.png':\n Metadata:\n major_brand : isom\n minor_version : 512\n compatible_brands: isomiso2avc1mp41\n encoder : Lavf61.7.100\n Stream #0:0(und): Video: png, rgb24(pc, gbr/unknown/unknown, progressive), 640x640, q=2-31, 200 kb/s, 16 fps, 16 tbn (default)\n Metadata:\n handler_name : VideoHandler\n vendor_id : [0][0][0][0]\n encoder : Lavc61.19.101 png\nframe= 12 fps=0.0 q=-0.0 size=N/A time=00:00:00.75 bitrate=N/A speed= 1.5x \rframe= 27 fps= 27 q=-0.0 size=N/A time=00:00:01.68 bitrate=N/A speed=1.69x \rframe= 44 fps= 29 q=-0.0 size=N/A time=00:00:02.75 bitrate=N/A speed=1.83x \rframe= 65 fps= 32 q=-0.0 size=N/A time=00:00:04.06 bitrate=N/A speed=2.03x \r[out#0/image2 @ 0x7b142fe375c0] video:57820KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown\nframe= 81 fps= 35 q=-0.0 Lsize=N/A time=00:00:05.06 bitrate=N/A speed=2.17x \nffmpeg version 7.1.1 Copyright (c) 2000-2025 the FFmpeg developers\n built with gcc 13.2.1 (Alpine 13.2.1_git20240309) 20240309\n configuration: --pkg-config-flags=--static --extra-cflags=-fopenmp --extra-ldflags='-fopenmp -Wl,--allow-multiple-definition -Wl,-z,stack-size=2097152' --toolchain=hardened --disable-debug --disable-shared --disable-ffplay --enable-static --enable-gpl --enable-version3 --enable-fontconfig --enable-gray --enable-iconv --enable-lcms2 --enable-libaom --enable-libaribb24 --enable-libass --enable-libbluray --enable-libdav1d --enable-libdavs2 --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libjxl --enable-libkvazaar --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librabbitmq --enable-librav1e --enable-librsvg --enable-librtmp --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libuavs3d --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libvvenc --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxevd --enable-libxeve --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-openssl\n libavutil 59. 39.100 / 59. 39.100\n libavcodec 61. 19.101 / 61. 19.101\n libavformat 61. 7.100 / 61. 7.100\n libavdevice 61. 3.100 / 61. 3.100\n libavfilter 10. 4.100 / 10. 4.100\n libswscale 8. 3.100 / 8. 3.100\n libswresample 5. 3.100 / 5. 3.100\n libpostproc 58. 3.100 / 58. 3.100\nInput #0, image2, from '/tmp/dithered_frames/frame_%04d.png':\n Duration: 00:00:05.06, start: 0.000000, bitrate: N/A\n Stream #0:0: Video: png, rgb24(pc, gbr/unknown/unknown), 640x640, 16 fps, 16 tbr, 16 tbn\nStream mapping:\n Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))\nPress [q] to stop, [?] for help\n[libx264 @ 0x754594d9b440] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512\n[libx264 @ 0x754594d9b440] profile High, level 3.0, 4:2:0, 8-bit\n[libx264 @ 0x754594d9b440] 264 - core 164 r3108 31e19f9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2023 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=16 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00\nOutput #0, mp4, to '/tmp/posterized_dithered_video.mp4':\n Metadata:\n encoder : Lavf61.7.100\n Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p(tv, progressive), 640x640, q=2-31, 16 fps, 16384 tbn\n Metadata:\n encoder : Lavc61.19.101 libx264\n Side data:\n cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A\nframe= 5 fps=0.0 q=27.0 size= 0KiB time=00:00:00.18 bitrate= 2.0kbits/s speed=0.375x \rframe= 21 fps= 21 q=27.0 size= 256KiB time=00:00:01.18 bitrate=1766.3kbits/s speed=1.19x \rframe= 37 fps= 25 q=27.0 size= 768KiB time=00:00:02.18 bitrate=2876.3kbits/s speed=1.46x \rframe= 63 fps= 31 q=27.0 size= 1280KiB time=00:00:03.81 bitrate=2750.5kbits/s speed=1.91x \r[out#0/mp4 @ 0x754594da9580] video:1514KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.119067%\nframe= 81 fps= 36 q=27.0 Lsize= 1516KiB time=00:00:04.93 bitrate=2515.0kbits/s speed=2.22x \n[libx264 @ 0x754594d9b440] frame I:1 Avg QP:22.28 size: 95587\n[libx264 @ 0x754594d9b440] frame P:20 Avg QP:22.50 size: 33664\n[libx264 @ 0x754594d9b440] frame B:60 Avg QP:25.45 size: 13014\n[libx264 @ 0x754594d9b440] consecutive B-frames: 1.2% 0.0% 0.0% 98.8%\n[libx264 @ 0x754594d9b440] mb I I16..4: 13.9% 8.1% 78.0%\n[libx264 @ 0x754594d9b440] mb P I16..4: 2.8% 4.3% 9.4% P16..4: 14.2% 18.1% 21.9% 0.0% 0.0% skip:29.4%\n[libx264 @ 0x754594d9b440] mb B I16..4: 0.6% 0.6% 1.9% B16..8: 24.4% 14.6% 8.8% direct: 6.4% skip:42.7% L0:34.0% L1:52.1% BI:13.9%\n[libx264 @ 0x754594d9b440] 8x8 transform intra:21.5% inter:12.1%\n[libx264 @ 0x754594d9b440] coded y,uvDC,uvAC intra: 62.9% 81.1% 78.5% inter: 25.5% 29.0% 24.6%\n[libx264 @ 0x754594d9b440] i16 v,h,dc,p: 41% 31% 23% 4%\n[libx264 @ 0x754594d9b440] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 13% 55% 3% 4% 3% 4% 2% 4%\n[libx264 @ 0x754594d9b440] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 23% 28% 4% 4% 4% 5% 3% 5%\n[libx264 @ 0x754594d9b440] i8c dc,h,v,p: 49% 28% 13% 11%\n[libx264 @ 0x754594d9b440] Weighted P-Frames: Y:5.0% UV:5.0%\n[libx264 @ 0x754594d9b440] ref P L0: 56.2% 12.8% 20.4% 10.7%\n[libx264 @ 0x754594d9b440] ref B L0: 86.1% 10.5% 3.3%\n[libx264 @ 0x754594d9b440] ref B L1: 96.3% 3.7%\n[libx264 @ 0x754594d9b440] kb/s:2448.90",
"output": "https://replicate.delivery/xezq/SC1Lpexy1swICKmP0gzpHlBrnPKf2ZgdJCPMQgw2wDdJWRLVA/posterized_dithered_video.mp4",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-08-15T16:35:16.84Z",
"started_at": "2025-08-15T16:35:17.775303Z",
"completed_at": "2025-08-15T16:42:49.43808Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/a36dvzq8x1rma0crntartqg5jw/cancel",
"children": "https://api.replicate.com/v1/predictions/a36dvzq8x1rma0crntartqg5jw/children",
"get": "https://api.replicate.com/v1/predictions/a36dvzq8x1rma0crntartqg5jw",
"root": "https://api.replicate.com/v1/predictions/a36dvzq8x1rma0crntartqg5jw",
"stream": "https://stream.replicate.com/v1/files/bcwr-dryn2xnmiq7mkajcdp2ile3fgx3fti6ewj3avixhyl2hvg5zpsca",
"web": "https://replicate.com/p/a36dvzq8x1rma0crntartqg5jw"
},
"metrics": {
"predict_time": 451.662776545,
"total_time": 452.59808
}
}