Models
Register, update, version and run models, and manage the reference data they are explained against.
A model is a feature schema, an output definition and an inference configuration, plus whatever you attach to it: reference data, an uploaded structure, logged predictions, explanations and insights. Address a model by id or slug everywhere. Deleting a model deletes everything attached to it.
#The Model object
Returned by every model endpoint. Single-model reads add explain_methods.
Attributes
mdl_ identifier.Display name and URL-safe slug, unique within the organization. Slugs are derived from the name unless given.
Version label, "1" by default. Versions of one model share a lineage_id.
binary_classification, multiclass_classification or regression.sklearn, pytorch, tensorflow, keras, xgboost, lightgbm, catboost, onnx, huggingface, llm or custom. Informational.The feature schema, normalised.
Labels, positive label, threshold, name, unit, kind. Binary models always have labels, positive_label and threshold filled in.
How Kaimei runs the model. Header values are returned as ••••••.
active or archived.The project the model belongs to.
Rows of reference data stored.
Running totals.
Activity markers.
Methods POST /v1/explanations accepts for this model, recommended first. Only on single-model reads.
Yours. metadata is free-form JSON.
{
"object": "model",
"id": "mdl_390bd6d9568f626851ef",
"name": "Credit risk scorer",
"slug": "credit-risk-v3",
"version": "3",
"description": "Consumer-credit decline model with a utilization × debt-to-income interaction.",
"framework": "sklearn",
"task": "binary_classification",
"features": [
{
"name": "income",
"type": "numeric",
"unit": "USD/yr",
"baseline": 65000,
"min": 0,
"description": "Annual gross income"
},
{
"name": "credit_score",
"type": "integer",
"baseline": 690,
"min": 300,
"max": 850,
"description": "Bureau credit score"
},
{
"name": "utilization",
"type": "numeric",
"baseline": 0.35,
"min": 0,
"max": 1.5
},
…,
{
"name": "home_ownership",
"type": "categorical",
"categories": ["rent", "mortgage", "own"],
"baseline": "mortgage"
}
],
"outputs": {
"labels": ["approve", "decline"],
"positive_label": "decline",
"threshold": 0.5,
"name": "decision"
},
"inference": {"type": "builtin", "name": "credit-risk"},
"tags": ["finance", "tabular"],
"metadata": {"owner": "risk-platform"},
"status": "active",
"project_id": "prj_40c081b2465e96db2cdc",
"lineage_id": "mdl_390bd6d9568f626851ef",
"forked_from": null,
"reference_rows": 600,
"predictions_count": 192,
"explanations_count": 12,
"last_prediction_at": "2026-10-31T22:37:25.682045Z",
"last_analyzed_at": "2026-10-31T22:37:26.872969Z",
"created_at": "2026-10-31T22:37:25.397790Z",
"updated_at": "2026-10-31T22:37:26.872969Z",
"explain_methods": ["shap", "shapley", "lime", "auto"]
}#List models
/v1/modelsAPI key or sessionModels in your organization, most recently updated first. Filters combine.
Query parameters
Case-insensitive match on name or slug.
active or archived.One of the three task types.
Only models in this project (id or slug).
Only models in no project. Not with project_id.
1 to 200.
Returns
page = client.models.list(status="active", limit=20)
for model in page.data:
print(model.slug, model.task, model.reference_rows)
for model in client.models.iterate(project_id="risk-platform"): # every page
...curl "https://api.kaimei.ai/v1/models?status=active&limit=20" \
-H "Authorization: Bearer $KAIMEI_API_KEY"{
"object": "list",
"data": [
{
"object": "model",
"id": "mdl_390bd6d9568f626851ef",
"name": "Credit risk scorer",
"slug": "credit-risk-v3",
"version": "3",
"description": "Consumer-credit decline model with a utilization × debt-to-income interaction.",
"framework": "sklearn",
"task": "binary_classification",
"features": …,
"outputs": {
"labels": ["approve", "decline"],
"positive_label": "decline",
"threshold": 0.5,
"name": "decision"
},
"inference": {"type": "builtin", "name": "credit-risk"},
"tags": ["finance", "tabular"],
"metadata": {"owner": "risk-platform"},
"status": "active",
"project_id": "prj_40c081b2465e96db2cdc",
"lineage_id": "mdl_390bd6d9568f626851ef",
"forked_from": null,
"reference_rows": 600,
"predictions_count": 192,
"explanations_count": 12,
"last_prediction_at": "2026-10-31T22:37:25.682045Z",
"last_analyzed_at": "2026-10-31T22:37:26.872969Z",
"created_at": "2026-10-31T22:37:25.397790Z",
"updated_at": "2026-10-31T22:37:26.872969Z",
"explain_methods": null
},
…
],
"total": 5,
"limit": 20,
"offset": 0,
"has_more": true
}#Register a model
/v1/modelsAPI key or sessionRegister a model. Give it a feature schema and a task, or a structure spec from which Kaimei infers both, or a builtin inference that supplies them.
Binary models get labels, positive_label and threshold defaults; multiclass models must name their outputs.labels. Remote image settings are validated against the image features.
Body parameters
1 to 120 characters.
Required unless structure or a built-in inference provides it.
The feature schema. Required unless provided by structure or a built-in.
Unique within the organization; 409 slug_taken if not. Derived from name when omitted.
Version label.
Labels, positive label, threshold, name, unit, kind.
A kaimei.structure.v1 spec to store with the model, the same document as PUT …/structure.
Project id or slug to file the model under.
Free-form.
Returns
201. Counts against the models quota and the 40-per-hour model limit.model = client.models.create(
name="Credit risk (docs)",
slug="credit-risk-docs",
task="binary_classification",
framework="sklearn",
features=[
{"name": "income", "type": "numeric", "unit": "USD / year", "min": 0},
{"name": "credit_score", "type": "integer", "min": 300, "max": 850},
{"name": "utilization", "type": "numeric", "min": 0, "max": 1},
{"name": "home_ownership", "type": "categorical", "categories": ["rent", "mortgage", "own"]},
],
outputs={"labels": ["approve", "decline"], "positive_label": "decline", "threshold": 0.5, "name": "decision"},
inference={"type": "remote", "url": "https://scoring.example.com/predict",
"headers": {"X-Api-Key": "secret"}, "timeout_s": 10},
tags=["lending", "pd"],
metadata={"owner": "risk-platform", "git_sha": "a9adc16"},
project_id="risk-platform",
)curl -X POST https://api.kaimei.ai/v1/models \
-H "Authorization: Bearer $KAIMEI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Credit risk (docs)",
"slug": "credit-risk-docs",
"task": "binary_classification",
"framework": "sklearn",
"features": [
{"name": "income", "type": "numeric", "unit": "USD / year", "min": 0},
{"name": "credit_score", "type": "integer", "min": 300, "max": 850},
{"name": "utilization", "type": "numeric", "min": 0, "max": 1},
{"name": "home_ownership", "type": "categorical", "categories": ["rent", "mortgage", "own"]}
],
"outputs": {"labels": ["approve", "decline"], "positive_label": "decline", "name": "decision"},
"inference": {"type": "remote", "url": "https://scoring.example.com/predict",
"headers": {"X-Api-Key": "secret"}, "timeout_s": 10},
"tags": ["lending", "pd"],
"project_id": "risk-platform"
}'{
"object": "model",
"id": "mdl_c48c5582152e44e34e64",
"name": "Credit risk (docs)",
"slug": "credit-risk-docs",
"version": "1",
"description": null,
"framework": "sklearn",
"task": "binary_classification",
"features": [
{
"name": "income",
"type": "numeric",
"min": 0.0,
"unit": "USD / year"
},
{
"name": "credit_score",
"type": "integer",
"min": 300.0,
"max": 850.0
},
…
],
"outputs": {
"labels": ["approve", "decline"],
"positive_label": "decline",
"threshold": 0.5,
"name": "decision"
},
"inference": {
"type": "remote",
"url": "https://scoring.example.com/predict",
"headers": {"X-Api-Key": "••••••"},
"timeout_s": 10.0
},
"tags": ["lending", "pd"],
"metadata": {"owner": "risk-platform", "git_sha": "a9adc16"},
"status": "active",
"project_id": "prj_40c081b2465e96db2cdc",
"lineage_id": "mdl_c48c5582152e44e34e64",
"forked_from": null,
"reference_rows": 0,
"predictions_count": 0,
"explanations_count": 0,
"last_prediction_at": null,
"last_analyzed_at": null,
"created_at": "2026-10-31T22:40:23.015774Z",
"updated_at": "2026-10-31T22:40:23.016780Z",
"explain_methods": null
}#Retrieve a model
/v1/models/{model}API key or sessionOne model by id or slug, with explain_methods.
Path parameters
Model id or slug.
Returns
model = client.models.retrieve("credit-risk-v3")
print(model.explain_methods) # ['shap', 'shapley', 'lime', 'auto']curl https://api.kaimei.ai/v1/models/credit-risk-v3 \
-H "Authorization: Bearer $KAIMEI_API_KEY"{
"object": "model",
"id": "mdl_390bd6d9568f626851ef",
"name": "Credit risk scorer",
"slug": "credit-risk-v3",
"version": "3",
"description": "Consumer-credit decline model with a utilization × debt-to-income interaction.",
"framework": "sklearn",
"task": "binary_classification",
"features": [
{
"name": "income",
"type": "numeric",
"unit": "USD/yr",
"baseline": 65000,
"min": 0,
"description": "Annual gross income"
},
{
"name": "credit_score",
"type": "integer",
"baseline": 690,
"min": 300,
"max": 850,
"description": "Bureau credit score"
},
{
"name": "utilization",
"type": "numeric",
"baseline": 0.35,
"min": 0,
"max": 1.5
},
…,
{
"name": "home_ownership",
"type": "categorical",
"categories": ["rent", "mortgage", "own"],
"baseline": "mortgage"
}
],
"outputs": {
"labels": ["approve", "decline"],
"positive_label": "decline",
"threshold": 0.5,
"name": "decision"
},
"inference": {"type": "builtin", "name": "credit-risk"},
"tags": ["finance", "tabular"],
"metadata": {"owner": "risk-platform"},
"status": "active",
"project_id": "prj_40c081b2465e96db2cdc",
"lineage_id": "mdl_390bd6d9568f626851ef",
"forked_from": null,
"reference_rows": 600,
"predictions_count": 192,
"explanations_count": 12,
"last_prediction_at": "2026-10-31T22:37:25.682045Z",
"last_analyzed_at": "2026-10-31T22:37:26.872969Z",
"created_at": "2026-10-31T22:37:25.397790Z",
"updated_at": "2026-10-31T22:37:26.872969Z",
"explain_methods": ["shap", "shapley", "lime", "auto"]
}#Update a model
/v1/models/{model}API key or sessionChange any registration field. Only the fields you send change. Sending inference.headers with the redacted •••••• values keeps the stored secrets.
Changing features re-validates the schema; changing version must not collide with a sibling version (409 version_taken). project_id: null takes the model out of its project.
Path parameters
Model id or slug.
Body parameters
Replaces the schema.
Replaces the output definition.
Replaces the inference configuration.
active or archived.Move into a project, or out of one with null.
Replace the whole list or object.
Returns
client.models.update("credit-risk-docs",
description="Scores loan applications for the consumer book.",
tags=["lending", "pd", "consumer"])
client.models.assign_project("credit-risk-docs", None) # leave the project
client.models.update("credit-risk-docs", status="archived")curl -X PATCH https://api.kaimei.ai/v1/models/credit-risk-docs \
-H "Authorization: Bearer $KAIMEI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"description": "Scores loan applications for the consumer book.", "tags": ["lending", "pd", "consumer"]}'{
"object": "model",
"id": "mdl_c48c5582152e44e34e64",
"name": "Credit risk scorer",
"slug": "credit-risk-docs",
"version": "3",
"description": "Scores loan applications for the consumer book.",
"framework": "sklearn",
"task": "binary_classification",
"features": …,
"outputs": {
"labels": ["approve", "decline"],
"positive_label": "decline",
"threshold": 0.5,
"name": "decision"
},
"inference": {"type": "builtin", "name": "credit-risk"},
"tags": ["lending", "pd", "consumer"],
"metadata": {"owner": "risk-platform"},
"status": "active",
"project_id": "prj_40c081b2465e96db2cdc",
"lineage_id": "mdl_390bd6d9568f626851ef",
"forked_from": null,
"reference_rows": 600,
"predictions_count": 192,
"explanations_count": 12,
"last_prediction_at": "2026-10-31T22:37:25.682045Z",
"last_analyzed_at": "2026-10-31T22:37:26.872969Z",
"created_at": "2026-10-31T22:37:25.397790Z",
"updated_at": "2026-10-31T22:40:23.026660Z",
"explain_methods": null
}#Delete a model
/v1/models/{model}API key or sessionDelete the model and everything attached to it: predictions, explanations, analyses, insights and structure. Other versions in the lineage are untouched. Frees the model's quota slot and its logged predictions.
Path parameters
Model id or slug.
Returns
client.models.delete("credit-risk-docs")curl -X DELETE https://api.kaimei.ai/v1/models/credit-risk-docs \
-H "Authorization: Bearer $KAIMEI_API_KEY"{
"id": "mdl_c48c5582152e44e34e64",
"object": "model",
"deleted": true
}#List versions
/v1/models/{model}/versionsAPI key or sessionEvery model in the lineage of this one, oldest first. Each version is a full Model object with its own counts.
Path parameters
Any version's id or slug.
Returns
limit equals the count).for version in client.models.versions("credit-risk-v3").data:
print(version.version, version.slug, version.created_at)curl https://api.kaimei.ai/v1/models/credit-risk-v3/versions \
-H "Authorization: Bearer $KAIMEI_API_KEY"{
"object": "list",
"data": [
{
"object": "model",
"id": "mdl_390bd6d9568f626851ef",
"name": "Credit risk scorer",
"slug": "credit-risk-v3",
"version": "3",
"description": "Consumer-credit decline model with a utilization × debt-to-income interaction.",
"framework": "sklearn",
"task": "binary_classification",
"features": …,
"outputs": {
"labels": ["approve", "decline"],
"positive_label": "decline",
"threshold": 0.5,
"name": "decision"
},
"inference": {"type": "builtin", "name": "credit-risk"},
"tags": ["finance", "tabular"],
"metadata": {"owner": "risk-platform"},
"status": "active",
"project_id": "prj_40c081b2465e96db2cdc",
"lineage_id": "mdl_390bd6d9568f626851ef",
"forked_from": null,
"reference_rows": 600,
"predictions_count": 192,
"explanations_count": 12,
"last_prediction_at": "2026-10-31T22:37:25.682045Z",
"last_analyzed_at": "2026-10-31T22:37:26.872969Z",
"created_at": "2026-10-31T22:37:25.397790Z",
"updated_at": "2026-10-31T22:37:26.872969Z",
"explain_methods": null
},
{
"object": "model",
"id": "mdl_431c8cbe592dde2673c7",
"name": "Credit risk scorer",
"slug": "credit-risk-v3-4",
"version": "4",
"description": "Consumer-credit decline model with a utilization × debt-to-income interaction.",
"framework": "sklearn",
"task": "binary_classification",
"features": …,
"outputs": {
"labels": ["approve", "decline"],
"positive_label": "decline",
"threshold": 0.5,
"name": "decision"
},
"inference": {"type": "builtin", "name": "credit-risk"},
"tags": ["finance", "tabular"],
"metadata": {"owner": "risk-platform"},
"status": "active",
"project_id": "prj_40c081b2465e96db2cdc",
"lineage_id": "mdl_390bd6d9568f626851ef",
"forked_from": null,
"reference_rows": 600,
"predictions_count": 0,
"explanations_count": 0,
"last_prediction_at": "2026-10-31T22:37:25.682045Z",
"last_analyzed_at": "2026-10-31T22:37:26.872969Z",
"created_at": "2026-10-31T22:37:25.397790Z",
"updated_at": "2026-10-31T22:37:26.872969Z",
"explain_methods": null
}
],
"total": 2,
"limit": 2,
"offset": 0,
"has_more": false
}#Create a version
/v1/models/{model}/versionsAPI key or sessionCopy this model into a new version: schema, outputs, inference, tags, metadata, reference data and structure all carry over; history (predictions, explanations, insights) stays on the version that produced it. The new slug defaults to {slug}-{version}.
Path parameters
Id or slug of any version in the lineage.
Body parameters
New version label, unique in the lineage (409 version_taken). No slashes.
Defaults to the source model's name.
Defaults to {slug}-{version}.
Defaults to the source model's description.
Returns
201. Counts as a model for quota and rate-limit purposes.v4 = client.models.create_version("credit-risk-v3", version="4",
slug="credit-risk-v4",
description="Adds utilisation trend features.")
print(v4.lineage_id == client.models.retrieve("credit-risk-v3").lineage_id) # Truecurl -X POST https://api.kaimei.ai/v1/models/credit-risk-v3/versions \
-H "Authorization: Bearer $KAIMEI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"version": "4", "slug": "credit-risk-v4", "description": "Adds utilisation trend features."}'{
"object": "model",
"id": "mdl_431c8cbe592dde2673c7",
"name": "Credit risk scorer",
"slug": "credit-risk-v4",
"version": "4",
"description": "Adds utilisation trend features.",
"framework": "sklearn",
"task": "binary_classification",
"features": …,
"outputs": {
"labels": ["approve", "decline"],
"positive_label": "decline",
"threshold": 0.5,
"name": "decision"
},
"inference": {"type": "builtin", "name": "credit-risk"},
"tags": ["finance", "tabular"],
"metadata": {"owner": "risk-platform"},
"status": "active",
"project_id": "prj_40c081b2465e96db2cdc",
"lineage_id": "mdl_390bd6d9568f626851ef",
"forked_from": null,
"reference_rows": 600,
"predictions_count": 0,
"explanations_count": 0,
"last_prediction_at": null,
"last_analyzed_at": null,
"created_at": "2026-10-31T22:40:23.063556Z",
"updated_at": "2026-10-31T22:40:23.063556Z",
"explain_methods": null
}#Delete a version
/v1/models/{model}/versions/{version}API key or sessionDelete one version of a lineage with everything attached to it. version may be the version's id, its slug or its label; an ambiguous label returns 409 version_ambiguous.
Path parameters
Any version's id or slug.
Id, slug or label of the version to delete.
Returns
client.models.delete_version("credit-risk-v3", "4")curl -X DELETE https://api.kaimei.ai/v1/models/credit-risk-v3/versions/4 \
-H "Authorization: Bearer $KAIMEI_API_KEY"{
"id": "mdl_431c8cbe592dde2673c7",
"object": "model",
"deleted": true
}#Transfer a model
/v1/models/{model}/transferAdmin session onlyMove a model to another organization the signed-in account belongs to, with every version, its structure and weights, its reference data, and every prediction, explanation, analysis and insight logged against it. Nothing is copied and nothing stays behind. Ids are kept; a slug already used in the destination gets a suffix. The caller must be an owner or admin where the model is (403 admin_required) and at least a member of the destination (403 read_only_role). 409 analysis_in_progress while an analysis is running on it, and 409 prediction_id_conflict when the destination already has a prediction with one of its ids. The models count against the destination's plan (403 quota_exceeded), and predictions made this month count against its monthly limits from then on.
Path parameters
Model id or slug.
Body parameters
Id or slug of the destination. personal is the caller's personal workspace.
A project in the destination to put the model in, by id or slug.
Move every version. When false, only this one moves.
Returns
{object: "transfer", organization, project, models, credentials_removed}: the models as they are in the destination.client.auth.login(email="you@example.com", password="...")
moved = client.models.transfer("credit-risk-v3", organization="acme-risk")
client.auth.switch("acme-risk")
print([m.slug for m in moved.models])curl https://api.kaimei.ai/v1/models/credit-risk-v3/transfer \
-H "Authorization: Bearer $SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{"organization": "acme-risk"}'{
"object": "transfer",
"organization": {
"object": "organization",
"id": "org_5b1f0c9a7d2e4f6a8c3b",
"name": "Acme Risk",
"slug": "acme-risk",
"plan": "team",
"kind": "team",
"settings": {},
"quotas": null,
"role": "admin",
"member_count": 3,
"features": {"members": true},
"created_at": "2026-11-18T09:12:44.118203Z"
},
"project": null,
"models": [
{
"object": "model",
"id": "mdl_390bd6d9568f626851ef",
"slug": "credit-risk-v3",
"version": "3",
…: …
}
],
"credentials_removed": []
}#Fork a model
/v1/models/{model}/forkSession token onlyCopy a model into another organization and leave the original where it is. Without organization the copy goes to the caller's personal workspace. The copy holds what defines the model: its settings, versions, structure, weights and reference data. Predictions, explanations, analyses and insights stay with the original. Credentials for the model's own inference endpoint (inference.headers) are never copied; credentials_removed lists the slugs of the copies that need them saved again. Any member of the source may fork, a viewer included; the caller must be at least a member of the destination. The copies count against the destination's plan. Each copy records where it came from in forked_from.
Path parameters
Model id or slug.
Body parameters
Id or slug of the destination.
A project in the destination to put the copy in.
A name for the copy. The original's by default.
Copy every version. When false, only this one.
Returns
{object: "fork", organization, project, models, credentials_removed}: the copies. 201.client.auth.login(email="you@example.com", password="...")
client.auth.switch("acme-risk")
fork = client.models.fork("credit-risk-v3")
print(fork.organization.kind, fork.models[0].forked_from["organization_name"])curl https://api.kaimei.ai/v1/models/credit-risk-v3/fork \
-H "Authorization: Bearer $SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'{
"object": "fork",
"organization": {
"object": "organization",
"id": "org_c72a301b93331f42b7b9",
"name": "Kaimei Demo",
"slug": "kaimei-demo",
"plan": "team",
"kind": "personal",
"settings": {},
"quotas": null,
"role": "owner",
"member_count": 1,
"features": {"members": true},
"created_at": "2026-11-18T09:12:44.118203Z"
},
"project": null,
"models": [
{
"object": "model",
"id": "mdl_c41d7a90e2b85f3a6d17",
"slug": "credit-risk-v3",
"version": "3",
"predictions_count": 0,
"forked_from": {
"organization_id": "org_5b1f0c9a7d2e4f6a8c3b",
"organization_name": "Acme Risk",
"id": "mdl_390bd6d9568f626851ef",
"slug": "credit-risk-v3",
"name": "Credit risk scorer",
"version": "3",
"at": "2026-11-18T10:31:07.402118+00:00"
},
…: …
}
],
"credentials_removed": []
}#Upload reference data
/v1/models/{model}/reference-dataAPI key or sessionStore the rows explanations compare against and analyses study. Rows are validated against the schema; those that do not fit are skipped and counted in rejected. At most 5,000 rows are kept (fewer for image models), newest last.
With mode: "append" rows are added to the existing set; labels are kept only when both the existing set and the upload have them.
Path parameters
Model id or slug.
Body parameters
Feature rows, keyed by feature name. At least one.
One label per row, same length as rows. Optional; enables metric-based importance.
replace or append.Returns
sample of the first rows (images shown as a size label), the columns, the rejected count and the limit applied.client.models.upload_reference_data(
"credit-risk-v3",
rows=X_valid.to_dict(orient="records"),
labels=y_valid.tolist(),
mode="replace",
)curl -X PUT https://api.kaimei.ai/v1/models/credit-risk-v3/reference-data \
-H "Authorization: Bearer $KAIMEI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"rows": [
{"income": 72000, "credit_score": 681, "utilization": 0.41, "home_ownership": "rent"},
{"income": 125000, "credit_score": 760, "utilization": 0.12, "home_ownership": "own"},
{"income": 38000, "credit_score": 590, "utilization": 0.88, "home_ownership": "rent"}
],
"labels": ["decline", "approve", "decline"],
"mode": "replace"
}'{
"model_id": "mdl_390bd6d9568f626851ef",
"rows": 3,
"has_labels": true,
"sample": [
{
"income": 72000,
"credit_score": 681,
"utilization": 0.41,
"home_ownership": "rent"
},
{
"income": 125000,
"credit_score": 760,
"utilization": 0.12,
"home_ownership": "own"
},
…
],
"columns": [
"income", "credit_score", "utilization", "home_ownership"
],
"rejected": 0,
"limit": 5000
}#Retrieve the reference data summary
/v1/models/{model}/reference-dataAPI key or sessionHow many rows are stored and a sample of them. Rows themselves are not returned in bulk.
Path parameters
Model id or slug.
Query parameters
Rows to include in sample, 0 to 100.
Returns
summary = client.models.reference_data("credit-risk-v3", sample=2)curl https://api.kaimei.ai/v1/models/credit-risk-v3/reference-data?sample=2 \
-H "Authorization: Bearer $KAIMEI_API_KEY"{
"model_id": "mdl_390bd6d9568f626851ef",
"rows": 600,
"has_labels": true,
"sample": [
{
"income": 72000,
"credit_score": 681,
"utilization": 0.41,
"home_ownership": "rent"
},
…
],
"columns": [
"income", "credit_score", "utilization", "debt_to_income",
"loan_amount", "employment_years", "num_delinquencies",
"age", "home_ownership"
],
"rejected": 0,
"limit": null
}#Clear reference data
/v1/models/{model}/reference-dataAPI key or sessionRemove every stored reference row. Explanations fall back to logged predictions, then baselines.
Path parameters
Model id or slug.
Returns
object: "reference_data".client.models.delete_reference_data("credit-risk-v3")curl -X DELETE https://api.kaimei.ai/v1/models/credit-risk-v3/reference-data \
-H "Authorization: Bearer $KAIMEI_API_KEY"{
"id": "mdl_390bd6d9568f626851ef",
"object": "reference_data",
"deleted": true
}#Predict through Kaimei
/v1/models/{model}/predictAPI key or sessionRun the model through its inference configuration and return the prediction, logged by default with source: "kaimei". The output is normalised the way explanations report it: label, class index, probabilities and the positive-class value for classifiers; value, name and unit for regressions.
Needs a runnable model (remote, built-in or executable structure); otherwise 422 model_not_runnable. Inputs are validated strictly: 400 invalid_input names the problem.
Path parameters
Model id or slug.
Body parameters
A feature row. Missing features take their baseline.
Store the prediction. Counts against the predictions quota when true.
Stored on the prediction.
Returns
prediction = client.models.predict("credit-risk-v3", 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",
}, metadata={"channel": "web"})
print(prediction.output["label"], prediction.output["probabilities"])curl -X POST https://api.kaimei.ai/v1/models/credit-risk-v3/predict \
-H "Authorization: Bearer $KAIMEI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"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"},
"log": true, "metadata": {"channel": "web"}}'{
"object": "prediction",
"id": "pred_9001ef9f6aaa1a9d672f",
"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",
"class_index": 1,
"probability": 0.5947,
"probabilities": {"approve": 0.4053, "decline": 0.5947},
"target_label": "decline",
"target_index": 1,
"value": 0.5947,
"name": "decision"
},
"latency_ms": 0.41,
"source": "kaimei",
"metadata": {"channel": "web"},
"created_at": "2026-10-31T22:40:23.114275Z"
}#Model statistics
/v1/models/{model}/statsAPI key or sessionUsage and behaviour over the last days: counts, average logged latency, a daily series of predictions and explanations, a summary of the last 500 outputs (histogram, positive rate and label counts for classifiers) and the features that drove the last 200 explanations, ranked by mean absolute attribution.
Path parameters
Model id or slug.
Query parameters
Window for the series, 1 to 365.
Returns
stats = client.models.stats("credit-risk-v3", days=7)
print(stats.predictions_count, stats.output_summary["positive_rate"])
for row in stats.top_features[:3]:
print(row["feature"], row["share"])curl https://api.kaimei.ai/v1/models/credit-risk-v3/stats?days=7 \
-H "Authorization: Bearer $KAIMEI_API_KEY"{
"model_id": "mdl_390bd6d9568f626851ef",
"predictions_count": 193,
"explanations_count": 12,
"analyses_count": 1,
"insights_count": 7,
"avg_latency_ms": 31.39,
"last_prediction_at": "2026-10-31T22:40:23.111634Z",
"last_analyzed_at": "2026-10-31T22:37:26.872969Z",
"series": [
{"date": "2026-10-24", "predictions": 1, "explanations": 0},
{"date": "2026-10-25", "predictions": 18, "explanations": 0},
…
],
"output_summary": {
"n": 193,
"mean": 0.4807,
"std": 0.3119,
"min": 0.0024,
"max": 0.9987,
"histogram": {
"counts": [14, 13, …],
"edges": [0.0024, 0.0522, …]
},
"positive_rate": 0.4663,
"label_counts": {"decline": 90, "approve": 103}
},
"top_features": [
{
"feature": "credit_score",
"mean_abs_attribution": 0.178539,
"mean_attribution": -0.018133,
"share": 0.2691
},
{
"feature": "income",
"mean_abs_attribution": 0.10523,
"mean_attribution": 0.055998,
"share": 0.1586
},
…
]
}#Model performance
/v1/models/{model}/performanceAPI key or sessionHow well the model did against real outcomes for the predictions logged in the last days, overall and per calendar day, week (from Monday) or month in UTC. Predictions are placed by when they were made, not when their outcome arrived, so recent windows fill in as outcomes come back.
A binary classifier gets accuracy, precision, recall, specificity, F1, false and predicted positive rates, a confusion matrix and, when its outputs carry a probability, AUC, the Brier score and a ten-bin calibration table with its expected calibration error (ece). A multiclass model gets accuracy, macro precision, recall and F1, per-class numbers and the confusion matrix (rows are what happened, columns what the model said). A regression gets MAE, RMSE, bias (mean of predicted minus actual) and R². standard_errors give the uncertainty of the headline numbers; a window with a few dozen outcomes is mostly noise.
The probability is read from probabilities[positive class], then value (Kaimei's own outputs), then probability, which is taken as the probability of the predicted label. Logging probabilities by class name is the unambiguous form.
Path parameters
Model id or slug.
Query parameters
day, week or month.How far back to look, 1 to 730.
Returns
predictions logged in the range and how many are labeled (coverage is the share), primary_metric (auc for a binary model with probabilities, accuracy for other classifiers, mae for a regression), overall metrics and a series of windows with the headline metrics. truncated is true when the range held more than 100,000 outcomes and only the newest were read.report = client.models.performance("credit-risk-v3", window="week", days=90)
print(report.coverage, report.primary_metric, report.overall["auc"])
kaimei.display.rows(report) # one row per week, ready for pandascurl https://api.kaimei.ai/v1/models/credit-risk-v3/performance?window=week&days=90 \
-H "Authorization: Bearer $KAIMEI_API_KEY"{
"object": "performance",
"model_id": "mdl_390bd6d9568f626851ef",
"task": "binary_classification",
"window": "week",
"days": 90,
"since": "2026-08-10T17:50:36.231688Z",
"predictions": 1400,
"labeled": 1285,
"coverage": 0.9179,
"truncated": false,
"latest_actual_at": "2026-11-08T17:50:36.221689Z",
"primary_metric": "auc",
"higher_is_better": true,
"overall": {
"task": "binary_classification",
"n": 1285,
"unscored": 0,
"accuracy": 0.937743,
"precision": 0.938871,
"recall": 0.935937,
"specificity": 0.939535,
"f1": 0.937402,
"false_positive_rate": 0.060465,
"predicted_positive_rate": 0.496498,
"actual_positive_rate": 0.498054,
"positive_label": "decline",
"confusion": {
"labels": ["approve", "decline"],
"matrix": [[606, 39], [41, 599]]
},
"standard_errors": {"accuracy": 0.00674, "auc": 0.003351},
"scored_rows": 1285,
"auc": 0.985735,
"brier": 0.086845,
"calibration": {
"bins": [
{
"lower": 0.0,
"upper": 0.1,
"count": 129,
"mean_predicted": 0.043203,
"observed_rate": 0.0
},
{
"lower": 0.1,
"upper": 0.2,
"count": 110,
"mean_predicted": 0.153345,
"observed_rate": 0.0
},
…
],
"ece": 0.180018
}
},
"series": [
{
"start": "2026-08-17",
"end": "2026-08-24",
"n": 116,
"accuracy": 0.956897,
"precision": 0.983051,
"recall": 0.935484,
"specificity": 0.981481,
"f1": 0.958678,
"auc": 0.990143,
"brier": 0.082421,
"predicted_positive_rate": 0.508621,
"actual_positive_rate": 0.534483
},
…,
{
"start": "2026-10-26",
"end": "2026-11-02",
"n": 113,
"accuracy": 0.725664,
"precision": 0.775862,
"recall": 0.714286,
"specificity": 0.74,
"f1": 0.743802,
"auc": 0.836667,
"brier": 0.17517,
"predicted_positive_rate": 0.513274,
"actual_positive_rate": 0.557522
}
]
}