Overview

Kaimei API Documentation

Everything the API does, with the answer it sends back.

Register a model, explain any prediction, study the whole model and watch it in production. The REST API and the Python client side by side, with real responses from the reference models.

base https://api.kaimei.ai/v1auth Bearer km_live_…client pip install kaimeiformat JSON

#Introduction

Kaimei (解明) turns a deployed model into something you can inspect. Every capability is a plain HTTPS endpoint under https://api.kaimei.ai/v1, and the official Python client mirrors those endpoints one for one, so everything on this page shows both.

  • Explanations answer why this prediction: KernelSHAP, permutation Shapley and LIME attributions for table rows; Grad-CAM, occlusion and LIME heatmaps for images; optional counterfactuals.
  • Analyses study the whole model and produce insights: global importance, behaviour curves, interactions, robustness, drift, learned rules and output behaviour.
  • Predictions are logged, either by your own stack or by Kaimei running the model, so anything can be explained later and monitored for drift.
  • Structure exposes the architecture of an uploaded model: layers, weights, a replay of one prediction and what every layer computed.

Requests and responses are JSON. Authentication is a bearer token. Lists are paginated with limit and offset. Errors share one envelope with a machine-readable code. The interactive OpenAPI reference lives at https://api.kaimei.ai/docs and the raw specification at /openapi.json.

What Kaimei keeps Kaimei never stores your training data or your model file. It stores the feature schema you register, the reference rows you choose to upload, the layers and weights you choose to extract, and the predictions and explanations it produces.

For risk and compliance teams Reviewing models rather than building them? Start with Reading an explanation, then see what Kaimei can and can't explain and the pages on adverse action reasons and the EU AI Act.

from kaimei import Kaimei

client = Kaimei(api_key="km_live_...")

explanation = client.explanations.create(
    model="credit-risk-v3",
    input={"income": 72000, "credit_score": 681, "utilization": 0.41},
    method="shap",
)
print(explanation.output["label"], explanation.output["probability"])
for row in explanation.top_features:
    print(row["feature"], row["attribution"])
curl https://api.kaimei.ai/v1/explanations \
  -H "Authorization: Bearer km_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "credit-risk-v3",
    "input": {"income": 72000, "credit_score": 681, "utilization": 0.41},
    "method": "shap"
  }'
201 CreatedResponse
{
  "object": "explanation",
  "id": "exp_7d7add16c796eafac087",
  "model_id": "mdl_390bd6d9568f626851ef",
  "method": "shap",
  "output": {
    "label": "approve",
    "probability": 0.757,
    "target_label": "decline",
    "value": 0.243,
    "name": "decision"
  },
  "base_value": 0.4904,
  "top_features": [
    {
      "feature": "utilization",
      "attribution": -0.072307,
      "value": 0.41,
      "share": 0.2743,
      "direction": "negative",
      "rank": 1
    },
    {
      "feature": "income",
      "attribution": -0.056984,
      "value": 72000,
      "share": 0.2161,
      "direction": "negative",
      "rank": 2
    },
    …
  ],
  "n_evals": 32770,
  "latency_ms": 359.4,
  "created_at": "2026-10-31T22:49:26Z"
}

Browse the documentation

Stuck, or found a gap?

Open an issue on GitHub and we will read it. The example repository's README has a troubleshooting section for the common cases.