Skip to main content

kaimei

PyPI Python versions License

Official Python client for the Kaimei explainability API.

Kaimei (解明) — to clarify, elucidate, reveal through investigation — turns trained black-box models into something you can inspect: feature-level attributions, global behaviour, learned rules, robustness, and drift.

from kaimei import Kaimei

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

explanation = client.explanations.create(
    model="credit-risk-v3",
    prediction_id="pred_8f2a19",
    input={
        "income": 72000,
        "credit_score": 681,
        "utilization": 0.41,
    },
)

print(explanation.output)
print(explanation.top_features)
# 0.81 decline  |  credit_score -0.22

The same call as POST https://api.kaimei.ai/v1/explanations. See the product site for the language-agnostic REST examples.

Install

pip install kaimei

For a local API (the kaimei-api service in the KaimeiAI/kaimei repo):

client = Kaimei(api_key="km_test_...", base_url="http://localhost:8000")

KAIMEI_API_KEY and KAIMEI_BASE_URL are read from the environment when arguments are omitted.

What you can do

# Register a model (or point Kaimei at a remote inference URL / built-in demo)
client.models.create(
    name="Credit risk v3",
    slug="credit-risk-v3",
    task="binary_classification",
    features=[
        {"name": "income", "type": "numeric"},
        {"name": "credit_score", "type": "integer"},
        {"name": "utilization", "type": "numeric"},
    ],
    inference={"type": "builtin", "name": "credit-risk"},
)

# Log a prediction your own stack already made
client.predictions.create(model="credit-risk-v3", input={...}, output={"score": 0.81})

# Explain one input (Shapley by default; LIME or pre-computed attributions also accepted)
client.explanations.create(model="credit-risk-v3", input={...}, method="shapley")

# Study the model as a whole, then read the insights
analysis = client.analyses.create(model="credit-risk-v3", type="full")
client.analyses.wait(analysis.id)
insights = client.insights.list(model="credit-risk-v3")

Dashboard sign-in (session token) is also supported via client.auth.login(...) / client.auth.signup(...).

Resources

Attribute Endpoints
client.models /v1/models
client.predictions /v1/predictions
client.explanations /v1/explanations
client.analyses /v1/analyses
client.insights /v1/insights
client.auth /v1/auth
client.api_keys /v1/api-keys
client.organization /v1/organization

Errors raise kaimei.KaimeiError subclasses (AuthenticationError, NotFoundError, …) and expose .code, .type, and .status_code.

License

Apache 2.0. Copyright Kaimei AI.

Metadata

Release files for kaimei 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kaimei 0.1.0
File Size Uploaded Provenance
kaimei-0.1.0.tar.gz 15.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for kaimei 0.1.0
File Interpreter ABI Platform
kaimei-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 33.5 kB

Release files / kaimei-0.1.0.tar.gz

Download URL kaimei-0.1.0.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e1fb9fe282ebd7f8b6a4526671b7891b8e08634079d709ee4bbb4d01b5d5a102
BLAKE2b-256 checksum
How to use checksums
1eff30897609dd21243ec840b2c45096e4abf9c8f7c9da81d68e05e9af8e0d07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release files / kaimei-0.1.0-py3-none-any.whl

Download URL kaimei-0.1.0-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca6ff89ec7849b0e5248a302d19b173d9d4f992d56c2696e53b90d3fc8bf6e58
BLAKE2b-256 checksum
How to use checksums
61b69a389a04d64edc692ad2dfa6756a1336c312ff047b550b63b47be7079cf3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Security for kaimei 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kaimei-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page