REST API Documentation

Public endpoints for programmatic access to ML model inference. No authentication required.

Base URL https://hasanai.net
{% include 'projects/_api_endpoint.html' with method="GET" path="/api/models/" title="List available models" description="Returns all public models with a live API endpoint enabled." response_example='{"count": 2, "models": [{"id": 1, "title": "EEG Seizure Detection", "model_type": "Classification", "accuracy_score": 0.966, "avg_inference_ms": 120, "input_type": "file", "endpoint": "/api/models/1/predict/"}]}' %} {% include 'projects/_api_endpoint.html' with method="GET" path="/api/models/{id}/" title="Get model details + input schema" description="Returns full metadata including input schema required for the predict endpoint." response_example='{"id": 1, "title": "EEG Seizure Detection", "input_type": "file", "input_schema": [], "endpoint": "/api/models/1/predict/"}' %}
POST /api/models/{id}/predict/ Run inference

Run a prediction on the specified model. Returns prediction, confidence, label and latency.

File upload models

curl -X POST \
  https://hasanai.net/api/models/1/predict/ \
  -F "file=@eeg_sample.csv"

Manual input models

curl -X POST \
  https://hasanai.net/api/models/2/predict/ \
  -H "Content-Type: application/json" \
  -d '{"age": 35, "bmi": 24.5}'

Response

{
  "success": true,
  "prediction": 0.966,
  "confidence": 0.966,
  "label": "Seizure detected",
  "inference_ms": 118,
  "model_id": 1,
  "model_title": "EEG Seizure Detection"
}