Documentation

Replicate TypeScript API Library

This library provides convenient access to the Replicate REST API from server-side TypeScript or JavaScript.

Installation

npm install replicate

Usage

import Replicate from 'replicate';

const replicate = new Replicate({
  bearerToken: process.env['REPLICATE_API_TOKEN'], // This is the default and can be omitted
});

const prediction = await replicate.predictions.get({ prediction_id: 'gm3qorzdhgbfurvjtvhg6dckhu' });

console.log(prediction.id);