Inference
The three inference endpoints, their inputs, and how to read a diagnosis response.
Three endpoints, one response shape. Pick the one that matches the input you actually have: a clinic with symptom notes but no camera uses text, a screening programme with a fundus camera uses image, and a full consultation uses multimodal.
Text diagnosis
/api/v1/inference/textStructured clinical features in, diagnosis out. Served by the ANN-LSTM model unless model overrides it.
agesymptomslaboratory_resultsmedical_historyfamily_historymodelann-lstm, ann, lstm, gru, xgboost-gru.curl -X POST "https://api-diagnostics.karmat-hq.com/api/v1/inference/text" \
-H "X-API-Key: $DIAGNOSTICS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"age": 58,
"symptoms": ["blurred vision", "floaters", "difficulty seeing at night"],
"laboratory_results": { "HbA1c": "8.2%", "fasting_glucose": "9.1 mmol/L" },
"medical_history": "Type 2 diabetes, 11 years",
"family_history": "Mother had glaucoma"
}'Image diagnosis
/api/v1/inference/imageA multipart/form-data upload. The image field is the file itself; image_type describes what kind of capture it is.
imageimage_typecurl -X POST "https://api-diagnostics.karmat-hq.com/api/v1/inference/image" \
-H "X-API-Key: $DIAGNOSTICS_API_KEY" \
-F "[email protected]" \
-F "image_type=fundus"Multimodal diagnosis
/api/v1/inference/multimodalThe strongest pathway when you have both. Note the shape: clinical_data is a JSON-encoded string carrying the same body the text endpoint takes, sent as a form field alongside the image.
imageclinical_datacurl -X POST "https://api-diagnostics.karmat-hq.com/api/v1/inference/multimodal" \
-H "X-API-Key: $DIAGNOSTICS_API_KEY" \
-F "[email protected]" \
-F 'clinical_data={"age":58,"symptoms":["blurred vision","floaters"]}'Encode clinical_data, do not nest it
clinical_data as a nested multipart object is the most common integration mistake here and returns 422. Run it through your language's JSON serialiser and send the resulting string.The diagnosis response
All three endpoints return the same object.
{
"prediction": {
"condition": "diabetic_retinopathy",
"probabilities": {
"diabetic_retinopathy": 0.87,
"glaucoma": 0.06,
"cataract": 0.04,
"normal": 0.03
},
"model_version": "ann-lstm-v1.2.0"
},
"confidence": 0.87,
"treatment_recommendation": "Refer for dilated fundus examination within 2 weeks...",
"explanation": "Elevated HbA1c with reported floaters and night-vision loss...",
"image_object_key": null,
"disclaimer": "This output is an AI-generated clinical decision-support suggestion, not a medical diagnosis. A qualified clinician must review all findings and retains final decision authority."
}prediction.conditionprediction.probabilitiesprediction.model_versionconfidencetreatment_recommendationexplanationimage_object_keydisclaimerNever auto-act on a prediction
Errors
401403422body.age above 130 or an empty symptoms array.429