{}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Baq**********************************
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 ethulia/chengyu-generator using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {};
const output = await replicate.run("ethulia/chengyu-generator", { 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_Baq**********************************
This is your API token. Keep it to yourself.
import replicate
Run ethulia/chengyu-generator using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run("ethulia/chengyu-generator")
# 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_Baq**********************************
This is your API token. Keep it to yourself.
Run ethulia/chengyu-generator 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": {}
}' \
https://api.replicate.com/v1/models/ethulia/chengyu-generator/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "dxq7brmpqdrma0crc9es5vt5d4",
"model": "ethulia/chengyu-generator",
"version": "hidden",
"input": {},
"logs": "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\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/b9c2524430c117b0/tmpnwvoa_3l.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: 3961 kb/s\n Stream #0:0[0x1](und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(progressive), 640x640, 3959 kb/s, 24 fps, 24 tbr, 12288 tbn (default)\n Metadata:\n handler_name : VideoHandler\n vendor_id : [0][0][0][0]\nInput #1, mp3, from '/tmp/8f240a30e24f2302/tmp8960adfu.mp3':\n Metadata:\n encoder : Lavf58.29.100\n aigc : {\"aigc\": {\"Label\": \"1\", \"ContentProducer\": \"HUABABSpeech7E01\", \"ProduceID\": \"04db11ac3bf0e47a06e10814c1301c8e\"}}\n Duration: 00:00:02.20, start: 0.034531, bitrate: 134 kb/s\n Stream #1:0: Audio: mp3, 32000 Hz, mono, fltp, 128 kb/s\nInput #2, mp3, from '/tmp/898baea41848ddf2/tmpe8oslq0y.mp3':\n Metadata:\n encoder : Lavf58.29.100\n aigc : {\"aigc\": {\"Label\": \"1\", \"ContentProducer\": \"HUABABSpeech7E01\", \"ProduceID\": \"04db11adb3ca92c02fe94fff4e3ac23c\"}}\n Duration: 00:00:12.13, start: 0.034531, bitrate: 129 kb/s\n Stream #2:0: Audio: mp3, 32000 Hz, mono, fltp, 128 kb/s\nStream mapping:\n Stream #1:0 (mp3float) -> concat (graph 0)\n Stream #2:0 (mp3float) -> concat (graph 0)\n Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))\n volume:default (graph 0) -> Stream #0:1 (aac)\nPress [q] to stop, [?] for help\n[libx264 @ 0x612d11c51e80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512\n[libx264 @ 0x612d11c51e80] profile High, level 3.0, 4:2:0, 8-bit\n[libx264 @ 0x612d11c51e80] 264 - core 164 r3095 baee400 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - 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=24 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/tmp94fix8wz.mp4':\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: h264 (avc1 / 0x31637661), yuv420p(progressive), 640x640, q=2-31, 24 fps, 12288 tbn (default)\n Metadata:\n handler_name : VideoHandler\n vendor_id : [0][0][0][0]\n encoder : Lavc59.37.100 libx264\n Side data:\n cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A\n Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 32000 Hz, mono, fltp, 192 kb/s\n Metadata:\n encoder : Lavc59.37.100 aac\nframe= 1 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x \rframe= 64 fps=0.0 q=28.0 size= 0kB time=00:00:00.86 bitrate= 0.4kbits/s speed=1.68x \rframe= 91 fps= 90 q=28.0 size= 256kB time=00:00:01.98 bitrate=1057.2kbits/s speed=1.95x \rframe= 115 fps= 75 q=28.0 size= 512kB time=00:00:03.00 bitrate=1394.5kbits/s speed=1.97x \rframe= 142 fps= 70 q=28.0 size= 768kB time=00:00:04.12 bitrate=1524.2kbits/s speed=2.02x \rframe= 171 fps= 67 q=28.0 size= 1280kB time=00:00:05.34 bitrate=1962.2kbits/s speed= 2.1x \rframe= 200 fps= 65 q=28.0 size= 1280kB time=00:00:06.52 bitrate=1606.3kbits/s speed=2.14x \rframe= 224 fps= 63 q=28.0 size= 1536kB time=00:00:07.55 bitrate=1666.2kbits/s speed=2.12x \rframe= 249 fps= 61 q=28.0 size= 1792kB time=00:00:08.57 bitrate=1711.8kbits/s speed= 2.1x \rframe= 278 fps= 61 q=28.0 size= 2048kB time=00:00:09.82 bitrate=1707.8kbits/s speed=2.14x \rframe= 309 fps= 61 q=28.0 size= 2560kB time=00:00:11.07 bitrate=1894.1kbits/s speed=2.17x \rframe= 335 fps= 60 q=28.0 size= 2816kB time=00:00:12.16 bitrate=1897.1kbits/s speed=2.17x \rframe= 359 fps= 59 q=28.0 size= 3072kB time=00:00:13.15 bitrate=1913.5kbits/s speed=2.15x \rframe= 384 fps= 54 q=28.0 Lsize= 3643kB time=00:00:15.87 bitrate=1880.0kbits/s speed=2.24x \nvideo:3435kB audio:198kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.300692%\n[libx264 @ 0x612d11c51e80] frame I:2 Avg QP:19.02 size: 67769\n[libx264 @ 0x612d11c51e80] frame P:289 Avg QP:22.53 size: 10076\n[libx264 @ 0x612d11c51e80] frame B:93 Avg QP:27.78 size: 5042\n[libx264 @ 0x612d11c51e80] consecutive B-frames: 65.9% 4.7% 2.3% 27.1%\n[libx264 @ 0x612d11c51e80] mb I I16..4: 44.2% 10.6% 45.2%\n[libx264 @ 0x612d11c51e80] mb P I16..4: 3.3% 2.9% 1.4% P16..4: 34.5% 7.9% 7.6% 0.0% 0.0% skip:42.4%\n[libx264 @ 0x612d11c51e80] mb B I16..4: 1.5% 1.7% 0.7% B16..8: 30.9% 7.7% 2.5% direct: 3.8% skip:51.2% L0:49.2% L1:40.0% BI:10.8%\n[libx264 @ 0x612d11c51e80] 8x8 transform intra:37.0% inter:34.4%\n[libx264 @ 0x612d11c51e80] coded y,uvDC,uvAC intra: 43.5% 52.0% 20.9% inter: 22.0% 15.1% 4.1%\n[libx264 @ 0x612d11c51e80] i16 v,h,dc,p: 26% 35% 29% 10%\n[libx264 @ 0x612d11c51e80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 32% 41% 2% 2% 1% 3% 2% 4%\n[libx264 @ 0x612d11c51e80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 32% 25% 5% 5% 4% 6% 4% 6%\n[libx264 @ 0x612d11c51e80] i8c dc,h,v,p: 52% 28% 15% 4%\n[libx264 @ 0x612d11c51e80] Weighted P-Frames: Y:0.0% UV:0.0%\n[libx264 @ 0x612d11c51e80] ref P L0: 80.0% 11.5% 6.1% 2.3%\n[libx264 @ 0x612d11c51e80] ref B L0: 90.7% 7.2% 2.0%\n[libx264 @ 0x612d11c51e80] ref B L1: 96.1% 3.9%\n[libx264 @ 0x612d11c51e80] kb/s:1758.20\n[aac @ 0x612d11c56880] Qavg: 65023.262",
"output": "https://replicate.delivery/xezq/zZWAeZyNfOupnUwUeJ04Z0nnCGG7xmwhbGbChwExCUsGHyMqA/tmp94fix8wz.mp4",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-07-31T21:22:37.371Z",
"started_at": "2025-07-31T21:22:45.307374Z",
"completed_at": "2025-07-31T21:23:47.718051Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/dxq7brmpqdrma0crc9es5vt5d4/cancel",
"children": "https://api.replicate.com/v1/predictions/dxq7brmpqdrma0crc9es5vt5d4/children",
"get": "https://api.replicate.com/v1/predictions/dxq7brmpqdrma0crc9es5vt5d4",
"root": "https://api.replicate.com/v1/predictions/dxq7brmpqdrma0crc9es5vt5d4",
"stream": "https://stream.replicate.com/v1/files/bcwr-cysrw4cuqtuns2mstjxfv75672b4rl7hpzdy6wia52oo3j4lgoua",
"web": "https://replicate.com/p/dxq7brmpqdrma0crc9es5vt5d4"
},
"metrics": {
"predict_time": 62.410677423,
"total_time": 70.347051
}
}