Mosec

Mosec serves machine learning models with dynamic batching and CPU or GPU pipelines for inference workloads.

github.com/mosecorg/mosec
Mosec homepage screenshot

About Mosec

Mosec is an open-source framework for serving trained machine learning models as online APIs and microservices. Developers define a service in Python by subclassing Worker and implementing a forward method, reusing offline model code.

It aggregates requests from different users for batched inference and runs pipelined stages in separate processes for mixed CPU, GPU and IO work. It provides model warmup, graceful shutdown and Prometheus metrics for use with container orchestration. Installation requires Python 3.7 or above on Linux or macOS.

Key features

  • Aggregates requests from different users for batched inference
  • Runs pipelined stages in separate processes for mixed workloads
  • Defines model services in Python by subclassing Worker
  • Handles model warmup, graceful shutdown and Prometheus metrics
  • Supports Msgpack serialization for binary payloads such as images
  • Runs under Kubernetes or other container orchestration systems
Best for: Best for Python developers serving trained models as APIs with batching and staged CPU/GPU processing.
Good for
  • Python interface works across ML frameworks using offline testing code
  • Web layer and task coordination use Rust with async I/O
  • Includes warmup, graceful shutdown and Prometheus metrics for cloud deployment
Watch out for
  • Package install commands are documented for Linux or macOS only
  • Building from source requires installing Rust
  • Requires Python 3.7 or above

Mosec at a glance

Type
Open-source project
Pricing
Not confirmed. Check the site
Open source
Yes · Source code
Language
English
Last checked
Oct 5, 2026 · Online when checked
Listed
Oct 5, 2026

Mosec alternatives

Tools and sites you could use instead, ranked by how closely they match.

All 24 alternatives

Popular in AI Infrastructure & MLOps

Well-known listings from the same topic.

All 341

Mosec FAQ

How do I install Mosec?
It requires Python 3.7 or above. On Linux or macOS install with pip install -U mosec, conda install conda-forge::mosec, or pixi add mosec. To build from source, install Rust and run make package.
How do I define a model service?
Create a class that inherits mosec.Worker, load the model in __init__, and override the forward method to process single or batched inputs and return results.
How is Mosec run in production?
It is designed to run in the cloud with model warmup, graceful shutdown and Prometheus metrics, managed by Kubernetes or other container orchestration systems.
Is something wrong or out of date?

Tell us and an editor will check it.

Own this website?

Claim the listing and suggest updates yourself. An editor checks every claim first.

Claim this listing