Models

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, and the answers to registering, updating and versioning a model, add explain_methods and profile.

Attributes

idstring
mdl_ identifier.
name / slugstring

Display name and URL-safe slug, unique within the organization. Slugs are derived from the name unless given.

versionstring

Version label, "1" by default. Versions of one model share a lineage_id.

taskstring
binary_classification, multiclass_classification, regression, one of the generative tasks (text_generation, sequence_to_sequence, generation, embedding), or one whose answer is labels, boxes, a mask or a group (multilabel_classification, object_detection, segmentation, clustering).
frameworkstring
sklearn, pytorch, tensorflow, keras, xgboost, lightgbm, catboost, onnx, huggingface, llm or custom. Informational.
featuresarray

The feature schema, normalised.

outputsobject

Labels, positive label, threshold, name, unit, kind. Binary models always have labels, positive_label and threshold filled in.

inferenceobject

How Kaimei runs the model: remote, agent, builtin or none. Header values are returned as ••••••.

statusstring
active or archived.
project_idstring | null

The project the model belongs to.

reference_rowsinteger

Rows of reference data stored.

predictions_count / explanations_countinteger

Running totals.

last_prediction_at / last_analyzed_attimestamp | null

Activity markers.

explain_methodsarray | null

Methods POST /v1/explanations accepts for this model, recommended first. On single-model reads and writes; null in lists.

profileobject | null

What kind of model this is and what applies to it: see the model profile. On single-model reads and writes; null in lists.

tags, metadata, description

Yours. metadata is free-form JSON.

created_at / updated_attimestamp

The Model object
{
  "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"]
}

#The model profile

profile on GET /v1/models/{model} says what goes in and comes out, what the architecture is and how a prediction is made, and so which views, explanation methods and analyses apply. Nothing in it is stored: it is read off the model each time. The dashboard builds a model's page from it, and any client can.

Attributes

taskstring

The model's task.

inputs / primary_inputarray / string

The kinds of input, richest first: image, audio, text, sequence, tensor, table. A feature the model fills in itself (generated: true) is not an input.

outputstring
class, number, token, embedding, text (an encoder-decoder), labels, detections, mask, cluster, or for a generator image, sequence or tensor.
architectureobject
{family, kind, label}. kind is, for example, linear, mlp, cnn, rnn, transformer, tree, ensemble, composite, generator, diffusion, autoencoder, or schematic when no structure was uploaded.
structureobject
available, runnable, fidelity, engine (graph for a general model graph), drawn_steps (steps drawn and not run), nodes, parameters, and counts of attention_layers, recurrent_layers and convolution_layers.
runstring

How a prediction is made: server (Kaimei runs the structure), endpoint, agent, builtin or none.

live_valuesstring

Where the values inside the model come from when a prediction is watched passing through it: server, agent (the model's agent runs the real model) or none (drawn only).

views / view_labels / default_viewarray / object / string

The dashboard views that have something to show, in order: scan, graph, universe, lab, sight (image models), attention (a structure with attention weights), sequence (text and series), generate (language models, encoder-decoders and generators), contrast (tables and pictures answered with a class or a number), effect (networks), votes (forests), classic. Views that watch a prediction need live_values server or agent; contrast, effect and votes, which rerun the model with parts of it changed, need server.

explain_methodsarray

The methods that would run when sent alone, recommended first, the same list as the model's own explain_methods. Empty for a model nothing can run, and for one whose answer is a whole tensor, boxes, a mask or a group.

explanationsobject

What an explanation can be of (see models with several inputs). inputs: the pictures, texts, series, tensors and recordings options.feature accepts, in the order the model declares them; [] for a table. all_inputs: whether options.scope: "inputs" would be answered; false for a model with fewer than two inputs or none of those kinds, for one with more than 32 inputs, and for one whose table columns have nothing to be hidden with (no baseline, fewer than five reference rows and no logged prediction). default: what a request that names neither explains: "inputs", the name of one input, or "table".

textobject

For each text feature: tokenizer (as tokenize describes it, or null), split_by (server, agent for a vocabulary the model's agent splits, or none) and accepts_text (false when the feature takes token ids only).

agent_capabilitiesarray

Only for a model its agent runs: what its connected agents offer between them (predict, trace, activations, tokenize), and [] when none is connected. With none connected the profile says what an agent could do, the same before its agent first connects and after it leaves; whether one is connected is the agent's status. With agents connected, capabilities, views, explain_methods, live_values and text.{feature}.split_by say what those agents offer: one that only predicts gets no trace, no activations and none of the views that watch a prediction.

capabilitiesobject

Booleans: predict, explain, trace, activations, attention, generate, analyses and performance.

generationobject | null

For a generative model: {type, output}, type being autoregressive, seq2seq, single or diffusion, with steps when its sampler names them. It describes the model, whoever can run it now: whether it can be run is capabilities.generate.

review-sentiment-v1
{
  "object": "model.profile",
  "task": "binary_classification",
  "inputs": ["text"],
  "primary_input": "text",
  "output": "class",
  "architecture": {
    "family": "network",
    "kind": "transformer",
    "label": "Transformer"
  },
  "structure": {
    "available": true,
    "runnable": true,
    "fidelity": "exact",
    "engine": "graph",
    "drawn_steps": 0,
    "nodes": 64,
    "parameters": 19654,
    "attention_layers": 2,
    "recurrent_layers": 0,
    "convolution_layers": 0
  },
  "run": "server",
  "live_values": "server",
  "views": [
    "scan", "graph", "universe", "lab", "attention", "sequence",
    "effect", "classic"
  ],
  "view_labels": {
    "scan": "Scan",
    "graph": "Graph",
    "universe": "Universe",
    "lab": "Lab",
    "attention": "Attention",
    "sequence": "Sequence",
    "effect": "Effect",
    "classic": "Classic"
  },
  "default_view": "scan",
  "explain_methods": ["occlusion", "shapley"],
  "explanations": {
    "inputs": ["review"],
    "all_inputs": false,
    "default": "review"
  },
  "text": {
    "review": {
      "tokenizer": {
        "type": "word",
        "vocab_size": 62,
        "encodes": true,
        "lowercase": true,
        "pad_id": 0,
        "unk_id": 1,
        "mask_id": null,
        "prefix": [],
        "suffix": []
      },
      "split_by": "server",
      "accepts_text": true
    }
  },
  "capabilities": {
    "predict": true,
    "explain": true,
    "trace": true,
    "activations": true,
    "attention": true,
    "generate": false,
    "analyses": true,
    "performance": true
  },
  "generation": null
}

#List models

GET/v1/modelsAPI key or session

Models in your organization, most recently updated first. Filters combine.

Query parameters

qstringoptional

Case-insensitive match on name or slug.

statusstringoptional
active or archived.
taskstringoptional

One of the task types.

project_idstringoptional

Only models in this project (id or slug).

unassignedbooleanoptionaldefault false

Only models in no project. Not with project_id.

limitintegeroptionaldefault 50

1 to 200.

offsetintegeroptionaldefault 0

Returns

A page of Model objects.
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"
200 OKResponse
{
  "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

POST/v1/modelsAPI key or session

Register 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

namestringrequired

1 to 120 characters.

taskstringoptional

Required unless structure or a built-in inference provides it.

featuresarrayoptional

The feature schema. Required unless provided by structure or a built-in.

slugstringoptional

Unique within the organization; 409 slug_taken if not. Derived from name when omitted.

versionstringoptionaldefault "1"

Version label.

descriptionstringoptional

frameworkstringoptionaldefault "custom"

outputsobjectoptional

Labels, positive label, threshold, name, unit, kind.

inferenceobjectoptionaldefault {"type": "none"}
{"type": "remote", "url": …}, {"type": "agent"}, {"type": "builtin", "name": …} or {"type": "none"}. See inference.
structureobjectoptional

A kaimei.structure.v1 spec to store with the model, the same document as PUT …/structure.

project_idstringoptional

Project id or slug to file the model under.

tagsarray of stringsoptional

metadataobjectoptional

Free-form.

Returns

The created Model, with explain_methods and profile. 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"
  }'
201 CreatedResponse
{
  "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

GET/v1/models/{model}API key or session

One model by id or slug, with explain_methods and its profile.

Path parameters

modelstringrequired

Model id or slug.

Returns

A Model.
model = client.models.retrieve("credit-risk-v3")
print(model.explain_methods)   # ['shap', 'shapley', 'lime', 'auto']
print(model.profile["views"], model.profile["run"])
curl https://api.kaimei.ai/v1/models/credit-risk-v3 \
  -H "Authorization: Bearer $KAIMEI_API_KEY"
200 OKResponse
{
  "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"],
  "profile": {
    "object": "model.profile",
    "task": "binary_classification",
    "inputs": ["table"],
    "primary_input": "table",
    "output": "class",
    "architecture": {
      "family": "network",
      "kind": "additive",
      "label": "Additive"
    },
    "structure": {
      "available": true,
      "runnable": true,
      "fidelity": "exact",
      "engine": "network",
      "drawn_steps": 0,
      "nodes": 23,
      "parameters": 30,
      "attention_layers": 0,
      "recurrent_layers": 0,
      "convolution_layers": 0
    },
    "run": "builtin",
    "live_values": "server",
    "views": [
      "scan", "graph", "universe", "lab", "contrast", "effect",
      "classic"
    ],
    "view_labels": {"scan": "Scan", "graph": "Graph", …: …},
    "default_view": "scan",
    "explain_methods": ["shap", "shapley", "lime", "auto"],
    "explanations": {
      "inputs": [],
      "all_inputs": false,
      "default": "table"
    },
    "text": {},
    "capabilities": {
      "predict": true,
      "explain": true,
      "trace": true,
      "activations": true,
      "attention": false,
      "generate": false,
      "analyses": true,
      "performance": true
    },
    "generation": null
  }
}

#Update a model

PATCH/v1/models/{model}API key or session

Change 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

modelstringrequired

Model id or slug.

Body parameters

name, slug, version, description, framework, taskoptional

featuresarrayoptional

Replaces the schema.

outputsobjectoptional

Replaces the output definition.

inferenceobjectoptional

Replaces the inference configuration.

statusstringoptional
active or archived.
project_idstring | nulloptional

Move into a project, or out of one with null.

tags, metadataoptional

Replace the whole list or object.

Returns

The updated Model, with explain_methods and profile.
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"]}'
200 OKResponse
{
  "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

DELETE/v1/models/{model}API key or session

Delete 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

modelstringrequired

Model id or slug.

Returns

A deletion receipt.
client.models.delete("credit-risk-docs")
curl -X DELETE https://api.kaimei.ai/v1/models/credit-risk-docs \
  -H "Authorization: Bearer $KAIMEI_API_KEY"
200 OKResponse
{
  "id": "mdl_c48c5582152e44e34e64",
  "object": "model",
  "deleted": true
}

#List versions

GET/v1/models/{model}/versionsAPI key or session

Every model in the lineage of this one, oldest first. Each version is a full Model object with its own counts.

Path parameters

modelstringrequired

Any version's id or slug.

Returns

A page holding all versions (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"
200 OKResponse
{
  "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

POST/v1/models/{model}/versionsAPI key or session

Copy 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

modelstringrequired

Id or slug of any version in the lineage.

Body parameters

versionstringrequired

New version label, unique in the lineage (409 version_taken). No slashes.

namestringoptional

Defaults to the source model's name.

slugstringoptional

Defaults to {slug}-{version}.

descriptionstringoptional

Defaults to the source model's description.

Returns

The new Model. 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)   # True
curl -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."}'
201 CreatedResponse
{
  "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

DELETE/v1/models/{model}/versions/{version}API key or session

Delete 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

modelstringrequired

Any version's id or slug.

versionstringrequired

Id, slug or label of the version to delete.

Returns

A deletion receipt.
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"
200 OKResponse
{
  "id": "mdl_431c8cbe592dde2673c7",
  "object": "model",
  "deleted": true
}

#Transfer a model

POST/v1/models/{model}/transferAdmin session only

Move 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. Ids are kept; a slug already used in the destination gets a suffix. Credentials for the model's own inference endpoint are removed, not moved, as a fork leaves them out: inference.headers, and any put in inference.url (a username and password, or a query parameter named like one, such as code, key, sig or a name ending in token, secret or _key; the URL keeps its other parameters). They were given to the organization it leaves, and the destination's members could otherwise call that endpoint with them. credentials_removed lists the slugs that need them saved again. 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 destination needs room on its plan for the models, and for the predictions, explanations and analyses made this month that come with them, since those count against its monthly limits from then on; otherwise 403 quota_exceeded, with details.moving saying how many this month's would add.

Path parameters

modelstringrequired

Model id or slug.

Body parameters

organizationstringrequired

Id or slug of the destination. personal is the caller's personal workspace.

projectstringoptional

A project in the destination to put the model in, by id or slug.

include_versionsbooleanoptionaldefault true

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"}'
200 OKResponse
{
  "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

POST/v1/models/{model}/forkSession token only

Copy 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 are never copied: inference.headers, and any put in inference.url, as a transfer removes them; 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

modelstringrequired

Model id or slug.

Body parameters

organizationstringoptionaldefault "personal"

Id or slug of the destination.

projectstringoptional

A project in the destination to put the copy in.

namestringoptional

A name for the copy. The original's by default.

include_versionsbooleanoptionaldefault true

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 '{}'
201 CreatedResponse
{
  "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

PUT/v1/models/{model}/reference-dataAPI key or session

Store 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

modelstringrequired

Model id or slug.

Body parameters

rowsarray of objectsrequired

Feature rows, keyed by feature name. At least one.

labelsarrayoptional

One label per row, same length as rows. Optional; enables metric-based importance.

modestringoptionaldefault "replace"
replace or append.

Returns

A reference-data summary: row count, whether labels are stored, a 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"
  }'
200 OKResponse
{
  "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

GET/v1/models/{model}/reference-dataAPI key or session

How many rows are stored and a sample of them. Rows themselves are not returned in bulk.

Path parameters

modelstringrequired

Model id or slug.

Query parameters

sampleintegeroptionaldefault 5

Rows to include in sample, 0 to 100.

Returns

A reference-data summary.
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"
200 OKResponse
{
  "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

DELETE/v1/models/{model}/reference-dataAPI key or session

Remove every stored reference row. Explanations fall back to logged predictions, then baselines.

Path parameters

modelstringrequired

Model id or slug.

Returns

A deletion receipt with 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"
200 OKResponse
{
  "id": "mdl_390bd6d9568f626851ef",
  "object": "reference_data",
  "deleted": true
}

#Predict through Kaimei

POST/v1/models/{model}/predictAPI key or session

Run 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, agent, built-in or executable structure); otherwise 422 model_not_runnable. Inputs are validated strictly: 400 invalid_input names the problem. A text feature takes a string or token ids, and a sequence or tensor feature its numbers (text and sequences). A language model's text longer than its max_length is 400 invalid_input; any other model's is cut, and output.input_truncated says so. All the passes of one request together may take 90 seconds (422 request_time_exceeded). A language model's output is its next token, and a generator's or an embedding's a tensor with a preview (generative models).

Path parameters

modelstringrequired

Model id or slug.

Body parameters

inputobjectrequired

A feature row. Missing features take their baseline.

logbooleanoptionaldefault true

Store the prediction. Counts against the predictions quota when true.

metadataobjectoptional

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"}}'
200 OKResponse
{
  "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"
}

#Generate

POST/v1/models/{model}/generateAPI key or session

Run a generative model's loop for one input: a language model writing token by token, a one-pass generator drawing from a seed, or a diffusion model denoising through its sampler. Every step is a real pass of the model wherever it runs: this server's processors, its endpoint or its agent. See Generate.

For text_generation, sequence_to_sequence and generation models; any other task is 422 not_applicable_for_task. The loop stays within 45 seconds, and takes fewer steps when the model is too slow for the ones asked for (stopped: "time"). A prompt longer than the language model's max_length is 400 invalid_input.

A generation is a prediction: it is logged, with what was made rather than every step, its id comes back as prediction_id, and it counts once toward predictions_per_month and the hourly predictions limit, however many steps or seeds it takes (403 quota_exceeded past the quota).

Path parameters

modelstringrequired

Model id or slug.

Body parameters

inputobjectoptionaldefault {}

The prompt for a language model, {"prompt": "the film was"}, and any conditioning for a model that draws. A tensor or sequence feature left out is given its baseline, or drawn from seed when it has none.

stepsintegeroptional

Tokens to write, or denoising steps to take, 1 to 1,024; a language model writes at most 512. Default: 32 tokens, or the steps the model's sampler names.

temperaturenumberoptionaldefault 0

0 to 5. 0 always takes the likeliest token; above it tokens are drawn from the model's distribution.

top_kintegeroptionaldefault 0

Draw only among this many likeliest tokens, 0 to 100,000. 0 is no limit.

top_pnumberoptionaldefault 1

Draw only among the likeliest tokens that together hold this much probability, above 0 to 1.

stop_tokensarray of integersoptional

Up to 64 token ids that end the text when chosen. The tokenizer's end-of-text token, and the tokens it adds at the end of a text, always do.

seedintegeroptionaldefault 0

0 to 232 − 1. Makes drawing reproducible.

seedsarray of integersoptional

One-pass generators: draw once for each seed, up to 16, returned as variations. One call. Not for a language model or a denoiser (422 not_applicable_for_task).

drawarray of stringsoptional

Tensor or sequence features to draw from the seed although they have a baseline. Any other name is 400 invalid_input.

Returns

A model.generation with kind (text, image, sequence or tensor), steps, stopped (steps, stop_token, length or time), requested_steps, ms and seed. Text adds feature, prompt, tokens (prompt and written ids), generated, text and stop_token; each step has index, position, token_id, token, probability, top, ms and the text written so far. A one-pass generator adds output, input (the values it drew) and, with seeds, variations of {seed, input, output}. A diffusion model adds output, timesteps and sample; its steps are up to 16 pictures with timestep and noise_level. A one-pass generator or a denoiser given a text longer than the model reads says so in output.input_truncated (and in each of variations), as a prediction does. Every generation carries prediction_id.
run = client.models.generate("review-writer-v1", input={"prompt": "the film was"},
                             steps=6, temperature=0.7, top_k=20, seed=3)
print(run.generated, run.stopped)         # hardly messy stop_token

picture = client.models.generate("shape-painter-v1", seed=4)
print(picture.output["shape"], picture.input)   # [16, 16, 1] {'latent': [...]}

strip = client.models.generate("shape-painter-v1", seeds=[1, 2, 3], draw=["latent"])
print(len(strip.variations), strip.prediction_id)   # 3 pred_...
curl -X POST https://api.kaimei.ai/v1/models/shape-painter-v1/generate \
  -H "Authorization: Bearer $KAIMEI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"seeds": [1, 2, 3]}'
200 OKResponse
{
  "object": "model.generation",
  "model_id": "mdl_da7dce9dd8da94a6a1b3",
  "kind": "image",
  "steps": [
    {"index": 0, "output": …}
  ],
  "stopped": "steps",
  "ms": 0.59,
  "output": {
    "kind": "image",
    "shape": [16, 16, 1],
    "size": 256,
    "summary": {
      "min": 0.0005301,
      "max": 0.85557252,
      "mean": 0.14635013,
      "std": 0.22094843
    },
    "preview": {
      "shape": [16, 16, 1],
      "range": [0.0005301, 0.85557252],
      "encoding": "u8",
      "data": "AAAAAAAAAQEBAQEB…"
    },
    "value": 0.14635013,
    "value_range": [0.0, 1.0],
    "name": "picture"
  },
  "input": {
    "latent": [
      0.12573, -0.132105, 0.640423, 0.1049, -0.535669, 0.361595
    ]
  },
  "requested_steps": 1,
  "variations": [
    {
      "seed": 1,
      "input": {
        "latent": [
          0.345584, 0.821618, 0.330437, -1.303157, 0.905356,
          0.446375
        ]
      },
      "output": …
    },
    …
  ],
  "seed": 0,
  "prediction_id": "pred_2193f2a2c93503d4e801"
}

#Tokenize

POST/v1/models/{model}/tokenizeAPI key or session

List exactly the tokens the model reads for a text, split by its tokenizer and cut as a prediction cuts it (the tokens that open and close a text kept), or name the tokens behind ids. It stores nothing, so it is a read: a key limited to models:read, a viewer, and an organization whose plan has paused it may call it. Calls with text are limited to 1,200 an hour on Free, more on paid plans; naming ids is not counted. Text needs a tokenizer that splits text: one Kaimei runs, or a pieces vocabulary split by the model's agent; otherwise 400 tokenizer_not_found. A model with no text feature, or none by that name, is 400 feature_not_found. See tokenizers.

Path parameters

modelstringrequired

Model id or slug.

Body parameters

textstringoptional

The text to split, up to 20,000 characters (400 text_too_long). Give text or ids.

idsarray of integersoptional

Token ids to name, up to 32,768.

featurestringoptional

The text feature whose tokenizer to use. Default: the model's first text feature.

Returns

A model.tokens: feature, tokens (each {token_id, token}, special tokens included), count, the feature's max_length, truncated (the text has more tokens than the model reads, and tokens stops at max_length; also for a feature that says "longer": "refuse", whose prediction of that text would be refused), and tokenizer: its type, vocab_size, encodes, lowercase, pad_id, unk_id, mask_id, prefix and suffix.
tokens = client.models.tokenize("review-sentiment-v1", text="The film was really wonderful.")
print(tokens.count, [t["token"] for t in tokens.tokens])

client.models.tokenize("review-sentiment-v1", ids=[2, 3, 4])
curl -X POST https://api.kaimei.ai/v1/models/review-sentiment-v1/tokenize \
  -H "Authorization: Bearer $KAIMEI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ids": [2, 3, 4]}'
200 OKResponse
{
  "object": "model.tokens",
  "model_id": "mdl_35636a1ada02058bf5fd",
  "feature": "review",
  "tokens": [
    {"token_id": 2, "token": "acting"},
    {"token_id": 3, "token": "admired"},
    {"token_id": 4, "token": "and"}
  ],
  "count": 3,
  "max_length": 16,
  "truncated": false,
  "tokenizer": {
    "type": "word",
    "vocab_size": 62,
    "encodes": true,
    "lowercase": true,
    "pad_id": 0,
    "unk_id": 1,
    "mask_id": null,
    "prefix": [],
    "suffix": []
  }
}

#Model statistics

GET/v1/models/{model}/statsAPI key or session

Usage 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

modelstringrequired

Model id or slug.

Query parameters

daysintegeroptionaldefault 30

Window for the series, 1 to 365.

Returns

A statistics object.
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"
200 OKResponse
{
  "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

GET/v1/models/{model}/performanceAPI key or session

How 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

modelstringrequired

Model id or slug.

Query parameters

windowstringoptionaldefault "week"
day, week or month.
daysintegeroptionaldefault 90

How far back to look, 1 to 730.

Returns

A performance object: 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 pandas
curl https://api.kaimei.ai/v1/models/credit-risk-v3/performance?window=week&days=90 \
  -H "Authorization: Bearer $KAIMEI_API_KEY"
200 OKResponse
{
  "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
    }
  ]
}