This is the main repository of the Monitaur project, an open-source platform for monitoring AI services. Funded by Netidee.
This is a lightweight, extensible monitoring server built with FastAPI, integrated with Prometheus for metrics collection. It leverages the reusable monitoring_toolkit
package to detect suspicious model inputs (e.g. low-confidence, repetitive, or anomalous queries).
- Plug-and-play detector system (
monitoring_toolkit
) - Built-in Prometheus metrics (suspicious counts, confidence scores, errors, etc.)
- FastAPI server to expose detection as an HTTP API
- Docker support for full stack orchestration
Clone the repo and start the full monitoring stack:
git clone https://github.com/sbaresearch/monitaur.git
cd monitaur
docker compose up --build
The API will be running at http://localhost:8000
, and Prometheus metrics at http://localhost:9090
.
Send detection requests to the /detect
endpoint:
POST /detect
Content-Type: application/json
{
"input_data": "This is a suspicious input",
"model_output": [0.25, 0.25, 0.25, 0.25],
"modality": "text"
}
You’ll get a response like:
{
"is_suspicious": true,
"confidence": 1.38,
"reason": "entropy mode: suspicious score = 1.3863, threshold = 0.8000"
}
You can also test the detection endpoint using the built-in client.py script:
python app/client.py
It will send a few example requests and print the detection results to the console.
Metrics are exposed at /metrics
. You’ll find:
detector_requests_total
: All incoming detection queriessuspicious_queries_total
: Total flagged queriesdetection_confidence_score
: Histogram of confidence scoresdetector_errors_total
: Internal processing errors
These metrics can be scraped by Prometheus and visualized (e.g. via Grafana).
Metrics can be extended with additional fields from each DetectionResult
, and customized further depending on the active detector’s behavior (e.g., tracking hash collisions for repetition, or distances for similarity).
To switch or extend detectors:
- Modify parameters of
get_detector
inapp/detectors.py
- Update
metrics.py
accordingly toDetectionResult
of the new detector - All detectors from
monitoring_toolkit
are supported:confidence
,repetition
,similarity
- Modal-specific versions:
text_similarity
,image_repetition
, etc.
Want to add your own? See the toolkit's README for instructions on writing and registering new detectors.
Here's what's inside docker-compose.yml
:
api
: Runs the FastAPI serverprometheus
: Collects metrics
- Python 3.10+
- Docker and Docker Compose
- Install Python dependencies via:
pip install -r requirements.txt