Skip to Content
OchreML
Commands

serve

Serve any .dit model over a zero-dependency stdlib HTTP server with GET /health and POST /predict endpoints.

ochreml serve loads a .dit model into memory and serves JSON inference requests over Python's standard library http.server.HTTPServer (^▽^).

Usage

ochreml serve <model> [--host HOST] [--port PORT] [--device DEVICE]

Arguments & Flags

Argument / FlagDefaultDescription
modelrequiredPath to .dit model file
--host127.0.0.1Bind host address
--port8080Bind TCP port
--deviceautoTarget device for inference (auto, cpu, cuda:0, wgpu, tpu)

HTTP Endpoints

Method & PathRequest BodySuccess Response (200 OK)
GET /healthnone{"status": "ok", "model_type": "...", "model_path": "...", "version": "..."}
POST /predict{"inputs": [[...]]} or {"X": [[...]]}{"predictions": [...], "model_type": "..."}

Invalid payloads return 400 Bad Request with {"error": "..."}; unknown routes return 404 Not Found.

Environment Variables

  • OCHREML_DEBUG=1: Enable per-request [ochreml serve] HTTP access logs on stderr (silent by default).

Example

ochreml serve models/ridge.dit --host 127.0.0.1 --port 8080

See the Local HTTP Model Serving guide for curl examples and deployment notes.

On this page