replicate-media
Installation
SKILL.md
Replicate media generation
Package: replicate (^1.4). Server-side only; keep REPLICATE_API_TOKEN out of client code.
import Replicate from "replicate";
const replicate = new Replicate({ auth: process.env.REPLICATE_API_TOKEN });
// Simple: waits for completion
const output = await replicate.run("owner/model:version", { input: { prompt } });
// Long jobs: create + poll/webhook
const prediction = await replicate.predictions.create({
model: "owner/model",
input: { prompt },
webhook: `${process.env.APP_URL}/api/replicate/webhook`,
webhook_events_filter: ["completed"],
});