ML Prediction Engine: Free Self-Hosted Machine Learning API

Updated July 2026
ML Prediction Engine is our open source machine learning API that you host yourself. Train real models on your own data, spam filters, lead scorers, ticket routers, anomaly alarms, then call them from any app over HTTPS and get an answer back in milliseconds. You pick a model from a catalog of 18, add example rows in a browser admin or through the API, click train, and start predicting. Your data stays on your server the whole time. The code is free on GitHub under the MIT license.

What ML Prediction Engine Is

Most businesses have prediction problems hiding in plain sight. Which support tickets belong to which team, which leads deserve a call first, which incoming messages are junk, which day's numbers look wrong. Solving them with machine learning usually means either paying a per-call cloud prediction service or asking a data scientist to build a custom pipeline. ML Prediction Engine is the third option: a small server you run yourself that turns "a folder of examples" into "an API that answers."

The workflow fits in one sentence. Create a pipeline, pick a model class, add labeled example rows, click train, and call predict from your code. The engine handles the machine learning underneath, text is vectorized automatically, numbers are scaled, models are stored as files on your disk, and every prediction is a fast local call on your own hardware with no per-request fees and no data leaving your server.

It is built for people who know their business data, whether or not they know machine learning. Every model class in the admin comes with plain-language parameter help and sensible defaults, and the dataset behind every model is a visible table you can read, edit, and retrain from at any time. If you have ever wanted the "train AI on your own data" idea to be a button instead of a project, this is that button.

The project is written and maintained by Paul Crinigan of AI Apps API, and the full source lives at github.com/AIAppsAPI/ML-Prediction-Engine.

What You Can Predict

The 18 model classes cover the four jobs that account for nearly every practical prediction task.

Classifiers predict a category. Feed them examples with labels, "refund my order" is billing, "app crashes on startup" is technical, and they label everything that arrives next. Seven classifier types are included, from K-Nearest Neighbors and Naive Bayes for fast simple jobs up to Random Forests and a neural network for messier data. This is the workhorse category: spam filtering, intent detection, ticket routing, sentiment, lead qualification.

Regressors predict a number. Train on rows like "1500 square feet, 3 bedrooms" with the price as the label, and the model predicts prices for homes it has never seen. Five regressor types cover linear problems, curve fitting, and everything between: deal size estimates, lead scores, delivery time predictions, demand forecasts.

Clusterers group similar things with no labels at all. Point one at your incoming feedback and it discovers the natural groups on its own, which is how you notice a new complaint theme appearing before anyone reads five hundred messages. K-Means, DBSCAN, and Gaussian Mixture each group differently, and the admin explains when each fits.

Anomaly detectors learn normal and flag weird. Train one on ordinary days of your metrics, requests, error counts, order values, and it answers a simple question about every new data point: does this look like the data I know? Isolation Forest, Local Outlier Factor, and Robust Z-Score cover the styles, and the answer comes back as a clean yes or no your alerting can act on.

Every category accepts text or numeric inputs. Send "give me a refund" or "1500, 3, 0.7", both just work, the engine prepares each kind automatically. The choosing a model guide walks the whole catalog in plain language, with a short playbook for picking your starting class.

How It Works: PHP Front, Python Brain

The engine is two small parts that install together. A PHP application serves the API, the admin area, and the pipeline configs, and a single-file Python worker runs the actual models on scikit-learn, the most widely used machine learning library in the world. The parts talk over your own machine, and you choose how in one config line: run the worker as a tiny background service, which Docker sets up automatically as a second container, or have PHP call Python per request with no service to manage at all.

Models are organized into pipelines. Most pipelines are one model, and that is the right shape for most jobs. When you need it, a pipeline chains a short sequence where each model's output feeds the next, and for full branching logic across many models and outside APIs, pipelines plug straight into our Workflow Chain Engine as a single step, predict, then branch on the answer.

Datasets You Can See, Training You Can Click

Every model's training data is a visible, editable table in the admin and a plain file on your disk. Add rows one at a time in the browser, push them in bulk through the API, delete the bad ones, and retrain with one click whenever the data changes. Training always rebuilds the model from the complete dataset, so what you see in the table is exactly what the model knows, and switching a step to a different model class keeps all of its training data ready to go.

The admin also has a test box on every pipeline: type an input, see the prediction and each step's output instantly. Between the visible datasets, the one-click training, and the test box, the tune-and-check loop takes seconds, which is what makes it practical to actually improve a model over time instead of shipping it once and forgetting how it works. The dataset and training guide covers the row formats, bulk loading, and the habits that grow accuracy.

Live Training: Models That Keep Learning

Flip one switch on a pipeline and it learns from its own traffic. Every prediction is added to the dataset, and after a number of new rows you choose, the model retrains itself automatically. This suits jobs where the data drifts and there is no single right answer to curate, engagement patterns, feedback grouping, evolving traffic, and it pairs naturally with the self-learning AI approach we write about across this site: systems that get better every day they run. For jobs where you want full control over the training data, leave the switch off and the model learns only what you feed it. The live training guide covers the mechanics, the tuning knob, and where each approach fits.

Quick Start

The fastest path is Docker: copy the sample config, set your keys, and run docker compose up --build. That starts the PHP app and the Python worker together, and the admin is at localhost:8080/admin.php, where you create a pipeline, add a few rows, train, and test a prediction on the same page.

Running without Docker needs PHP 8.1 or newer and Python 3.9 or newer with scikit-learn installed, one pip install. Start the worker with a single command, or set the config to call Python per request and skip the service entirely. Either way the storage is one SQLite file plus dataset and model files in one folder, with no database server to set up. The getting started guide covers every install path and config setting on the way to a first trained model.

The API at a Glance

Everything the admin does, the JSON API does too, secured by an API key header. The endpoints mirror the workflow: dataset/add appends a training row (with an option to retrain immediately), train rebuilds a model from its dataset, predict runs an input through a pipeline and returns the answer, and pipelines lists everything you have built, which makes wiring the engine into other systems a one-call discovery. A prediction response is small and direct: the output, plus each step's output when a pipeline has several.

That design means your app code stays trivial. Send a POST with an input, get back billing or 0.87 or anomaly: 1, and act on it. Any language, any framework, any platform that can make an HTTPS request. Every endpoint and field is documented in the API reference.

Use Cases to Steal

Ticket routing. A text classifier trained on last month's solved tickets, labels are your queues. New tickets arrive pre-sorted.

Lead scoring. A regressor on simple numbers, pages viewed, email opens, days since signup, with closed revenue as the label. Your sales team calls the highest scores first.

Spam and intent filtering. A classifier in front of inbound replies. Pairs perfectly with our SMS Campaign Engine and Email Campaign Engine, which handle the sending while this engine reads what comes back.

Ops anomaly alerts. An Isolation Forest trained on normal days of requests, errors, and latency. When the answer comes back as an anomaly, your workflow pages someone.

Feedback clustering. K-Means over incoming reviews, watched weekly. New clusters mean new themes worth a human look, which is AI analytics doing its best work: surfacing the question before you knew to ask it.

Optional AI Data Summaries

Alongside the trained models, a summarize endpoint sends any batch of data to a large language model, Anthropic or any OpenAI compatible provider, and stores a factual written summary in a reports history you can read in the admin. It is the quick "what is in this pile of responses" tool for data you have not built a model around yet, and it activates only when you add an LLM key to the config. The machine learning side runs entirely on your own hardware with no LLM involved.

Documentation and Guides

Setup and Reference

Building Models

The GitHub README is the fastest technical overview, and issues and contributions are welcome there.

Security Notes

Set the API key and admin password to long random strings before exposing the server, and serve over HTTPS in production. Keep the Python worker on localhost or a private network, it should only ever hear from your own PHP app, and the Docker setup already isolates it that way. Your datasets and trained models live as files on your server, so back up the data folder like anything else you value.

Key Takeaway

ML Prediction Engine turns your own examples into a prediction API you host yourself: 18 model classes across classification, regression, clustering, and anomaly detection, visible editable datasets, one-click training, optional live learning from real traffic, and a JSON API any app can call. Your data stays on your server, MIT licensed on GitHub.