ReleaseReplicateReplicatepublished Nov 17, 2025seen 5d

replicate/replicate-javascript v1.4.0

replicate/replicate-javascript

Open original ↗

Captured source

source ↗
published Nov 17, 2025seen 5dcaptured 9hhttp 200method plain

v1.4.0

Repository: replicate/replicate-javascript

Tag: v1.4.0

Published: 2025-11-17T11:17:19Z

Prerelease: no

Release notes: This is a bug-fix release that fixes the behavior of replicate.stream() when dealing with models that output files. By default the event.data will be a FileOutput instance that can be written to disk.

import Replicate from "replicate";
import * as fs from "node:fs/promises";

const replicate = new Replicate();
const input = {
prompt: "black forest gateau cake spelling out the words \"FLUX SCHNELL\", tasty, food photography, dynamic shot"
};

let index = 0;
for await (const event of replicate.stream("black-forest-labs/flux-schnell", { input })) {
if (event.event === "output") {
await fs.writeFile(`my-image-${index++}.png`, event.data);
}
}

The stream() method also now supports the useFileOutput option which, when false, will output the HTTP or data URL directly.

import Replicate from "replicate";
const replicate = new Replicate();

const input = {
prompt: "black forest gateau cake spelling out the words \"FLUX SCHNELL\", tasty, food photography, dynamic shot"
};

let index = 0;
for await (const event of replicate.stream("black-forest-labs/flux-schnell", { input, useFileOutput: false })) {
if (event.event === "output") {
console.log("URL:", event.data);
}
}

What's Changed

  • Fix url key of createFileOutput options for streaming by @sitatec in https://github.com/replicate/replicate-javascript/pull/350

New Contributors

  • @sitatec made their first contribution in https://github.com/replicate/replicate-javascript/pull/350

Full Changelog: https://github.com/replicate/replicate-javascript/compare/v1.3.1...v1.4.0

Notability

notability 3.0/10

Routine library release