OpenVINO Model API
Introduction
Model API is a set of wrapper classes for particular tasks and model architectures, simplifying data preprocess and postprocess as well as routine procedures (model loading, asynchronous execution, etc.). It is aimed at simplifying end-to-end model inference for different deployment scenarios, including local execution and serving. The Model API is based on the OpenVINO inference API.
How it works
Model API searches for additional information required for model inference, data, pre/postprocessing, label names, etc. directly in OpenVINO Intermediate Representation. This information is used to prepare the inference data, process and output the inference results in a human-readable format.
Currently, ModelAPI supports models trained in OpenVINO Training Extensions framework. Training Extensions embed all the metadata required for inference into model file. For models coming from other than Training Extensions frameworks metadata generation step is required before using ModelAPI.
Supported model formats
Features
- Python API
- Synchronous and asynchronous inference
- Local inference and serving through the REST API
- Model preprocessing embedding for faster inference
Installation
pip install openvino-model-api
Repository layout
This repository contains two independently installable Python subprojects:
model_api/— the inference library published asopenvino-model-apiwith a minimal runtime dependency set.model_converter/— conversion tooling published asopenvino-model-converter, with conversion-time dependencies such as PyTorch, TorchVision, OpenVINO, ONNX, and NNCF.
Each subproject owns its own pyproject.toml and uv.lock.
Shared repository files, including this README.md, LICENSE, CONTRIBUTING.md, SECURITY.md, and CI workflows, remain at the repository root.
Usage
from model_api.models import Model
# Create a model wrapper from a compatible model generated by OpenVINO Training Extensions
# To work with an OVMS-served model, pass its endpoint instead of a file path, e.g. "localhost:8000/v2/models/ssdlite_mobilenet_v2"
model = Model.create_model("model.xml")
# Run synchronous inference locally
result = model(image) # image is numpy.ndarray
# Print results in model-specific format
print(f"Inference result: {result}")
Prepare a model for InferenceAdapter
There are usecases when it is not possible to modify an internal ov::Model and it is hidden behind InferenceAdapter. For example the model can be served using OVMS. create_model() can construct a model from a given InferenceAdapter. That approach assumes that the model in InferenceAdapter was already configured by create_model() called with a string (a path or a model name). It is possible to prepare such model:
model = DetectionModel.create_model("~/.cache/omz/public/ssdlite_mobilenet_v2/FP16/ssdlite_mobilenet_v2.xml")
model.save("serialized.xml")
Usage with generic OpenVINO models
ModelAPI uses custom field in rt_info/model_info section of OpenVINO IR to store metadata required for preprocessing and postprocessing. If you have a generic OpenVINO model without such metadata, you can provide that metadata in configuration argument of create_model() method:
from model_api.models import Model
# Create a model wrapper from a compatible model generated by OpenVINO Training Extensions
model = Model.create_model(
"model.xml",
configuration={
"model_type": "Segmentation",
"blur_strength": 1,
"labels": ["object"],
"soft_threshold": 0.5,
}
)
# Run synchronous inference locally
result = model(image) # image is numpy.ndarray
# Print results in model-specific format
print(f"Inference result: {result}")
# Save the model with metadata already embedded (passing configuration is not required anymore)
model.save("serialized_with_metadata.xml")
For more details please refer to the examples of this project.
Metadata
Release files for openvino-model-api 0.4.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| openvino_model_api-0.4.7.tar.gz | 574.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| openvino_model_api-0.4.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 717.2 kB
Release files / openvino_model_api-0.4.7.tar.gz
| Download URL | openvino_model_api-0.4.7.tar.gz |
|---|---|
| Size | 574.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
778146c4263a7ce557b38ed35ae16056dc465d0f44cbbeb41df3c4043a1cbd03
|
|
BLAKE2b-256 checksum How to use checksums |
9beb8f6c819839c17587626bddc5a7c86af9cde2af0faeb08875f05f3c3d7052
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / openvino_model_api-0.4.7-py3-none-any.whl
| Download URL | openvino_model_api-0.4.7-py3-none-any.whl |
|---|---|
| Size | 143.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
483e1a38f5dd9ac5a76d325fe54acfa438b906395c6687975d3adbc2766f88d6
|
|
BLAKE2b-256 checksum How to use checksums |
5e1b74d9812a2ec295192c7776809e071d796c9d439f7b8468b62168282ebdb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency log