Predictions
Log the predictions your models make, or read back the ones Kaimei made, for explanation and monitoring.
A prediction is one input and the output a model produced for it. Log the predictions your own stack makes so they can be explained later and monitored for drift, or let Kaimei make them with POST /v1/models/{model}/predict.
#The Prediction object
The output is stored as you sent it: an object is kept as is, a number becomes {"value": n}, a string becomes {"label": s}, a boolean becomes a label and a value, a list becomes {"raw": [...]}. Predictions Kaimei makes carry the normalised output shown under predict.
Attributes
pred_ identifier, or the prediction_id you supplied (up to 64 characters).The feature row as sent. Image pixels are stored packed and read back as the same lists.
See above.
Your model's latency, if you logged it; Kaimei's own when it predicted.
api, sdk (the Python client), or kaimei (made by Kaimei, through predict or when an explanation ran with log_prediction).Yours.
The timestamp you sent, or the time of logging.
{
"object": "prediction",
"id": "pred_8f2a19",
"model_id": "mdl_390bd6d9568f626851ef",
"input": {
"income": 72000,
"credit_score": 681,
"utilization": 0.41,
"debt_to_income": 0.38,
"loan_amount": 18000,
"employment_years": 4,
"num_delinquencies": 1,
"age": 34,
"home_ownership": "rent"
},
"output": {"label": "decline", "probability": 0.81},
"latency_ms": 12.4,
"source": "api",
"metadata": {"request_id": "req_01HZX"},
"created_at": "2026-10-31T22:40:23.260448Z"
}#Log a prediction
/v1/predictionsAPI key or sessionRecord one prediction your model made. Counts against the monthly predictions quota and the 600-per-hour limit.
Body parameters
Model id or slug.
The feature row.
What the model returned: an object, a number, a string label, a boolean or a list.
Your own id for the record, up to 64 characters. Defaults to a generated pred_ id.
Your model's latency.
When the prediction happened, for backfills. Defaults to now.
Free-form.
Returns
201.client.predictions.create(
model="credit-risk-v3",
input=row,
output={"label": "decline", "probability": 0.81},
prediction_id="pred_8f2a19",
latency_ms=12.4,
metadata={"request_id": "req_01HZX"},
)curl -X POST https://api.kaimei.ai/v1/predictions \
-H "Authorization: Bearer $KAIMEI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "credit-risk-v3", "prediction_id": "pred_8f2a19", "latency_ms": 12.4,
"input": {"income": 72000, "credit_score": 681, "utilization": 0.41, "debt_to_income": 0.38, "loan_amount": 18000,
"employment_years": 4, "num_delinquencies": 1, "age": 34, "home_ownership": "rent"},
"output": {"label": "decline", "probability": 0.81}, "metadata": {"request_id": "req_01HZX"}}'{
"object": "prediction",
"id": "pred_8f2a19",
"model_id": "mdl_390bd6d9568f626851ef",
"input": {
"income": 72000,
"credit_score": 681,
"utilization": 0.41,
"debt_to_income": 0.38,
"loan_amount": 18000,
"employment_years": 4,
"num_delinquencies": 1,
"age": 34,
"home_ownership": "rent"
},
"output": {"label": "decline", "probability": 0.81},
"latency_ms": 12.4,
"source": "api",
"metadata": {"request_id": "req_01HZX"},
"created_at": "2026-10-31T22:40:23.260448Z"
}#Log many predictions
/v1/predictions/batchAPI key or sessionRecord up to 1,000 predictions in one request. Each item takes the same fields as a single prediction except model. The quota is checked once for the whole batch and the rate limit counts one hit.
Body parameters
Model id or slug.
1 to 1,000 items of {input, output?, prediction_id?, latency_ms?, timestamp?, metadata?}.
Returns
{"object": "list", "data": [...predictions], "count": n}.client.predictions.create_batch(model="credit-risk-v3", items=[
{"prediction_id": "pred_8f2a1a", "input": {**row, "income": 54000}, "output": 0.63},
{"prediction_id": "pred_8f2a1b", "input": {**row, "credit_score": 790, "utilization": 0.08},
"output": {"label": "approve", "probability": 0.91}},
])curl -X POST https://api.kaimei.ai/v1/predictions/batch \
-H "Authorization: Bearer $KAIMEI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "credit-risk-v3", "items": [
{"prediction_id": "pred_8f2a1a", "input": {"income": 54000, "credit_score": 681, "utilization": 0.41}, "output": 0.63},
{"prediction_id": "pred_8f2a1b", "input": {"income": 72000, "credit_score": 790, "utilization": 0.08},
"output": {"label": "approve", "probability": 0.91}}
]}'{
"object": "list",
"data": [
{
"object": "prediction",
"id": "pred_8f2a1a",
"model_id": "mdl_390bd6d9568f626851ef",
"input": {
"income": 54000,
"credit_score": 681,
"utilization": 0.41,
"debt_to_income": 0.38,
"loan_amount": 18000,
"employment_years": 4,
"num_delinquencies": 1,
"age": 34,
"home_ownership": "rent"
},
"output": {"value": 0.63},
"latency_ms": null,
"source": "api",
"metadata": {},
"created_at": "2026-10-31T22:40:23.268794Z"
},
{
"object": "prediction",
"id": "pred_8f2a1b",
"model_id": "mdl_390bd6d9568f626851ef",
"input": {
"income": 72000,
"credit_score": 790,
"utilization": 0.08,
"debt_to_income": 0.38,
"loan_amount": 18000,
"employment_years": 4,
"num_delinquencies": 1,
"age": 34,
"home_ownership": "rent"
},
"output": {"label": "approve", "probability": 0.91},
"latency_ms": null,
"source": "api",
"metadata": {},
"created_at": "2026-10-31T22:40:23.268794Z"
}
],
"count": 2
}#List predictions
/v1/predictionsAPI key or sessionPredictions in your organization, newest first.
Query parameters
Model id or slug.
api, sdk or kaimei.1 to 500.
Returns
page = client.predictions.list(model="credit-risk-v3", source="api", limit=100)
for prediction in client.predictions.iterate(model="credit-risk-v3"):
...curl "https://api.kaimei.ai/v1/predictions?model=credit-risk-v3&limit=2" \
-H "Authorization: Bearer $KAIMEI_API_KEY"{
"object": "list",
"data": [
{
"object": "prediction",
"id": "pred_8f2a1b",
"model_id": "mdl_390bd6d9568f626851ef",
"input": …,
"output": {"label": "approve", "probability": 0.91},
"latency_ms": null,
"source": "api",
"metadata": {},
"created_at": "2026-10-31T22:40:23.260448Z"
},
{
"object": "prediction",
"id": "pred_8f2a19",
"model_id": "mdl_390bd6d9568f626851ef",
"input": …,
"output": {"label": "decline", "probability": 0.81},
"latency_ms": 12.4,
"source": "api",
"metadata": {"request_id": "req_01HZX"},
"created_at": "2026-10-31T22:40:23.260448Z"
}
],
"total": 196,
"limit": 2,
"offset": 0,
"has_more": true
}#Retrieve a prediction
/v1/predictions/{prediction_id}API key or sessionOne prediction by id, including an id you supplied yourself.
Path parameters
Returns
prediction = client.predictions.retrieve("pred_8f2a19")curl https://api.kaimei.ai/v1/predictions/pred_8f2a19 \
-H "Authorization: Bearer $KAIMEI_API_KEY"{
"object": "prediction",
"id": "pred_8f2a19",
"model_id": "mdl_390bd6d9568f626851ef",
"input": {
"income": 72000,
"credit_score": 681,
"utilization": 0.41,
"debt_to_income": 0.38,
"loan_amount": 18000,
"employment_years": 4,
"num_delinquencies": 1,
"age": 34,
"home_ownership": "rent"
},
"output": {"label": "decline", "probability": 0.81},
"latency_ms": 12.4,
"source": "api",
"metadata": {"request_id": "req_01HZX"},
"created_at": "2026-10-31T22:40:23.260448Z"
}