Node.js client library


Replicate now has a client library for Node.js. You can use it to run models and everything else you can do with the HTTP API.

Install it from npm:

npm install replicate

Then, you can run predictions:

import Replicate from "replicate";

const replicate = new Replicate({
  auth: process.env.REPLICATE_API_TOKEN,

const model = "stability-ai/stable-diffusion:27b93a2413e7f36cd83da926f3656280b2931564ff050bf9575f1fdf9bcd7478";
const input = { prompt: "a 19th century portrait of a raccoon gentleman wearing a suit" };
const output = await, { input });
// ['']

Follow our guide to running a model from Node.js or read the full documentation on GitHub.