A Node.js client for Replicate.
npm install node-replicateA Node.js client for Replicate.
``js`
import replicate from "node-replicate"
`js
const model = "owner/model:version"
const input = { prompt: "an astronaut riding on a horse" }
await replicate.run(model, input)
`

Replicate is an online platform for running machine learning models in the cloud. This package implements a lightweight client for their anonymous API, allowing you to run Stable Diffusion, Whisper and other cutting-edge models in just a few lines of code 😄🤏.
* Anonymous API 👻.
* Lightweight - only 30 lines of code 🔥.
Install with npm.
`sh`
npm i node-replicate
To run a model, just pass its identifier and prediction parameters to replicate.run().
`js
const model = "owner/model:version"
const input = { prompt: "an astronaut riding on a horse" }
await replicate.run(model, input)
`
You can also monitor pending predictions with replicate.create().
`js
let prediction = await replicate.create(model, input)
prediction = await replicate.get(prediction)
`
Once the prediction has succeeded, prediction.status will be set to "succeeded"`.
Have a feature you'd like to see added? Create a pull request or open an issue.