Get started with ONNX Runtime Node.js binding

Contents

Install

# install latest release version
npm install onnxruntime-node

Import

// use ES6 style import syntax (recommended)
import * as ort from 'onnxruntime-node';
// or use CommonJS style import syntax
const ort = require('onnxruntime-node');

Examples

  • Follow the Quick Start instructions for ONNX Runtime Node.js binding.

Supported Versions

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 ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
DirectML ✔️ ✔️
CUDA ✔️[1]
  • [1]: CUDA v11.8.

For platforms not on the list or want a custom build, you can build Node.js binding from source and consume using npm install <onnxruntime_repo_root>/js/node/.