onnxruntime-node
TypeScript icon, indicating that this package has built-in type declarations

1.22.0 • Public • Published

ONNX Runtime Node.js Binding

ONNX Runtime Node.js binding enables Node.js applications to run ONNX model inference.

Usage

Install the latest stable version:

npm install onnxruntime-node

Install the nightly version:

npm install onnxruntime-node@dev

Refer to ONNX Runtime JavaScript examples for samples and tutorials.

Requirements

ONNXRuntime works on Node.js v16.x+ (recommend v20.x+) or Electron v15.x+ (recommend v28.x+).

The following table lists the supported versions of ONNX Runtime Node.js binding provided with pre-built binaries.

EPs/Platforms Windows x64 Windows arm64 Linux x64 Linux arm64 MacOS x64 MacOS arm64
CPU ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
WebGPU ✔️ [1] ✔️ [1] ✔️ [1] ✔️ [1] ✔️ [1] ✔️ [1]
DirectML ✔️ ✔️
CUDA ✔️[2]
CoreML ✔️ ✔️
  • [1]: WebGPU support is currently experimental.
  • [2]: CUDA v12. See CUDA EP Installation for details.

To use on platforms without pre-built binaries, you can build Node.js binding from source and consume it by npm install <onnxruntime_repo_root>/js/node/. See also instructions for building ONNX Runtime Node.js binding locally.

GPU Support

Right now, the Windows version supports WebGPU execution provider and DML execution provider. Linux x64 can use CUDA and TensorRT.

CUDA EP Installation

To use CUDA EP, you need to install the CUDA EP binaries. By default, the CUDA EP binaries are installed automatically when you install the package. If you want to skip the installation, you can pass the --onnxruntime-node-install=skip flag to the installation command.

npm install onnxruntime-node --onnxruntime-node-install=skip

You can also use this flag to specify the version of the CUDA: (v11 or v12) CUDA v11 is no longer supported since v1.22.

License

License information can be found here.

/onnxruntime-node/

    Package Sidebar

    Install

    npm i onnxruntime-node

    Weekly Downloads

    279,963

    Version

    1.22.0

    License

    MIT

    Unpacked Size

    247 MB

    Total Files

    44

    Last publish

    Collaborators

    • eire
    • onnxruntime