ModelRequest / ModelResponse schema is used everywhere; what differs is how you reach it:
- On-premise — path-based endpoints (
/api/embed/h1,/api/predict/m-optimus, …) on the container (default port 8080). Interactive Swagger UI is served at/docs, and the live schema at/openapi.json. - AWS SageMaker — a single
/invocationsendpoint that accepts aSageMakerRequest(aModelRequestplusmodel_nameandmodefor dispatch). - SDK — the Bioptimus SDK wraps both and is the recommended interface for whole-slide inference.
| Endpoint | Method | Purpose |
|---|---|---|
/invocations | POST | SageMaker dispatch (adds model_name, mode) |
/ping | GET | Health check |
/bioptimus/ | GET | Service discovery |
Authentication
The Model Server REST API requires no authentication. Deploy it on a private network and restrict access at the network layer. On AWS, the SageMaker endpoint is protected by IAM (requests are SigV4-signed); on Hugging Face, model access is gated.Errors
All endpoints return JSON. Common statuses:| Status | Meaning |
|---|---|
200 | Success |
422 | Validation error — malformed or missing fields (FastAPI HTTPValidationError) |
500 | Inference error |
503 | Model still loading, or GPU unavailable (see /ping states) |
422 body follows the FastAPI shape: {"detail": [{"loc": [...], "msg": "...", "type": "..."}]}.
