onnxruntime_extensions
ONNXRuntime Extensions
What it is and what it does
ONNXRuntime-Extensions is a C/C++ library that plugs into ONNX Runtime to add custom operators for common pre- and post-processing tasks in vision, text, and NLP models. It works by registering a custom operator library with an ONNX Runtime session, allowing you to build enhanced ONNX models that include these operators and run them end-to-end without leaving the ONNX Runtime inference engine. The package provides Python bindings (plus Java and C# support) and includes utilities to convert Hugging Face transformer data processing classes into ONNX graphs that can be merged with your model.
The typical workflow is to generate or enhance an ONNX model with preprocessing operators, then load it with ONNXRuntime-Extensions registered to handle those custom ops during inference. It supports Windows, macOS, Linux, and mobile platforms like Android and iOS, with compiled wheels available for recent Python versions.
Use it for:
- Embed tokenization and text normalization directly in ONNX models for end-to-end NLP inference without Python preprocessing.
- Add image resizing, normalization, and augmentation operators to vision models for deployment without external preprocessing.
- Convert Hugging Face transformer preprocessing pipelines into ONNX graphs for portable, framework-agnostic model deployment.
- Build mobile-ready ONNX models with built-in preprocessing for Android and iOS inference.
- Combine multiple models with standardized pre- and post-processing in a single ONNX graph.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Extends ONNX Runtime with custom operators for pre- and post-processing in vision, text, and NLP models, available as a C/C++ library with Python, Java, and C# bindings.
Yes, if you are building ONNX-based inference pipelines and need to embed preprocessing or postprocessing operators directly in your models. The package is actively maintained, has no known vulnerabilities, and uses a permissive MIT license. Install friction is moderate due to compiled wheels, but prebuilt binaries are available for common platforms and Python versions. Not necessary if you handle all preprocessing in application code before inference.
Install
onnxruntime-extensions on PyPI
pip
pip install onnxruntime-extensionsuv
uv add onnxruntime-extensionspoetry
poetry add onnxruntime-extensionsInstalling onnxruntime_extensions
Before you install
Medium install friction due to compiled wheels for multiple Python versions and platforms (cp310–cp313 on macOS and Linux). Repository is actively maintained with recent commits and no archived status.
License in practice
MIT License permits commercial and private use with minimal restrictions; suitable for most production deployments.
Quickstart
pip install onnxruntime-extensions
import onnxruntime as _ort
from onnxruntime_extensions import get_library_path as _lib_path
so = _ort.SessionOptions()
so.register_custom_ops_library(_lib_path())
# sess = _ort.InferenceSession(model, so)
Requires onnxruntime to be installed separately; ONNX package needed for generating pre-/post-processing models.
Verify before relying
- Whether the package works with all Python versions or only cp310–cp313 as wheel availability suggests.
- Specific minimum versions of onnxruntime required for compatibility.
- Performance characteristics or overhead of custom operator registration.
Package facts
| License | MIT License (permissive) |
| Python support | not specified |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 191 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 207,857/month — #9,540 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: onnxruntime_extensions-0.15.2-cp310-cp310-macosx_11_0_arm64.whl; onnxruntime_extensions-0.15.2-cp310-cp310-macosx_11_0_universal2.whl; onnxruntime_extensions-0.15.2-cp310-cp310-macosx_11_0_x86_64.whl; onnxruntime_extensions-0.15.2-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; onnxruntime_extensions-0.15.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; onnxruntime_extensions-0.15.2-cp311-cp311-macosx_11_0_arm64.whl; onnxruntime_extensions-0.15.2-cp311-cp311-macosx_11_0_universal2.whl; onnxruntime_extensions-0.15.2-cp311-cp311-macosx_11_0_x86_64.whl; onnxruntime_extensions-0.15.2-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; onnxruntime_extensions-0.15.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; onnxruntime_extensions-0.15.2-cp312-cp312-macosx_11_0_arm64.whl; onnxruntime_extensions-0.15.2-cp312-cp312-macosx_11_0_universal2.whl; onnxruntime_extensions-0.15.2-cp312-cp312-macosx_11_0_x86_64.whl; onnxruntime_extensions-0.15.2-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; onnxruntime_extensions-0.15.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; onnxruntime_extensions-0.15.2-cp313-cp313-macosx_11_0_arm64.whl; onnxruntime_extensions-0.15.2-cp313-cp313-macosx_11_0_universal2.whl; onnxruntime_extensions-0.15.2-cp313-cp313-macosx_11_0_x86_64.whl; onnxruntime_extensions-0.15.2-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; onnxruntime_extensions-0.15.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
onnxruntime-openvinoEnables ONNX Runtime to accelerate machine…
permissive · top 15,000 on PyPI
onnxruntimeonnxruntime loads and executes Open Neural…
permissive · top 1,000 on PyPI
onnxruntime-gpuExecutes ONNX machine learning models on GPU…
permissive · top 5,000 on PyPI
optimum-onnxExports Hugging Face transformer models to ONNX…
permissive · top 15,000 on PyPI
onnxslimOnnxSlim reduces the size and operator count of…
permissive · top 5,000 on PyPI
onnxONNX provides an open-source format and runtime…
permissive · top 5,000 on PyPI
onnxtrOnnxTR extracts and recognizes text from…
permissive · top 15,000 on PyPI
skl2onnxConverts trained scikit-learn models to ONNX…
permissive · top 5,000 on PyPI
qonnxQONNX provides Python utilities to work with…
permissive · top 15,000 on PyPI
DafnyRuntimePythonProvides the Python runtime library needed to…
permissive · top 15,000 on PyPI