Skip to content

Latest commit

 

History

History
 
 

README.md

OpenVINO™ for Node.js

openvino-node brings the OpenVINO™ Runtime to Node.js. Deploy deep learning models with high-performance, hardware-accelerated inference directly from JavaScript and TypeScript applications. The package provides bindings to a subset of the OpenVINO Runtime API.

Prebuilt native addons and the OpenVINO runtime are fetched during npm install. You do not need a separate OpenVINO SDK installation for typical use.

Key Features and Benefits:

  • 📦 Ready-to-use Runtime: Read, compile, and run OpenVINO IR, ONNX, TensorFlow, TFLite, and PaddlePaddle models directly from Node.js.
  • 📥 Plug-and-play install: Prebuilt native addons and the OpenVINO runtime are downloaded on npm install — no manual OpenVINO installation for typical use.
  • 🖥️ In-process inference: Run models directly inside your Node.js application process — no separate inference service or access tokens.
  • 🚀 Performance Optimization: Hardware-specific optimizations for CPU, GPU, and NPU devices, with synchronous and asynchronous inference.
  • 👨‍💻 Programming Language Support: API aligned with the OpenVINO Python/C++ APIs where possible, with TypeScript type definitions included.
  • 🧰 Preprocessing Support: Built-in pre/post-processing (layout, resize, element type conversion) via PrePostProcessor.

Example use cases

openvino-node can run any model supported by OpenVINO Runtime. The following tasks are demonstrated by the bundled samples and notebooks:

Quick install

npm install openvino-node
const { addon: ov } = require("openvino-node");

Requirements

Node.js ≥ 21. Refer to the supported platforms for more details.

Supported platforms

OS x86 ARM
Windows
Linux
macOS

Prebuilt binaries are downloaded for your OS/arch during npm install. If a platform is unsupported, you can build from source per the JavaScript API Developer Documentation.

Getting started

Model preparation

OpenVINO works best with models converted to OpenVINO IR (for example with Optimum Intel or ovc). ONNX, TensorFlow, TFLite, and PaddlePaddle models can also be read directly. See the model preparation documentation for more details.

Minimal example

Initialize the runtime Core, read a model, compile it for a device, and run inference:

const { addon: ov } = require("openvino-node");

async function main() {
  const core = new ov.Core(); // OpenVINO's starting point, one Core instance per application

  // Read and compile a model (OpenVINO IR, ONNX, TF, TFLite, or Paddle)
  const compiledModel = await core.compileModel("/path/to/model.xml", "CPU");

  // Allocate an input tensor (fill it with real input data for your model)
  const input = compiledModel.inputs[0];
  const inputTensor = new ov.Tensor(ov.element.f32, input.shape);

  // Create an infer request and run inference
  const inferRequest = compiledModel.createInferRequest();
  const result = inferRequest.infer([inputTensor]);
  // Read the output
  console.log(result[compiledModel.outputs[0]].data);

}

main();

Refer to the complete description of the addon API in the documentation.

More runnable examples are available in the OpenVINO Node.js samples.

Usage in Electron applications

To use the package in development of Electron applications on Windows, make sure that the Desktop development with C++ component from Build Tools for Visual Studio is installed.

Build From Sources

For more details, refer to the OpenVINO™ JavaScript API Developer Documentation

Contributing

Contributions are always welcome! Read the Contribution Guide to learn how you can get involved.

License

The OpenVINO™ repository is licensed under Apache License Version 2.0. By contributing to the project, you agree to the license and copyright terms therein and release your contribution under these terms.