ModelRunner provides a unified JavaScript/TypeScript SDK to call any supported model with a consistent interface. Use it in Node.js, serverless runtimes, and—via a proxy—in the browser.
For client-side apps, never expose secrets. Use the proxy pattern shown below to safely forward requests.
Upload local files to ModelRunner storage and receive a temporary URL you can pass to model inputs (for example, image or audio URLs).
Copy
import { modelrunner } from "@modelrunner/client";import fs from "node:fs";const fileBuffer = fs.readFileSync("./image.jpeg");const url = await modelrunner.storage.upload(new Blob([fileBuffer]));console.log(url);
You can then pass the returned url to your model input:
Copy
const result = await modelrunner.subscribe("swook/inspyrenet", { input: { image_path: url,},});
In Node.js, Blob is available in modern runtimes (Node 18+). If you use an older version, consider upgrading or using a compatible polyfill.The storage service accepts any binary file type (images, audio, video, documents).