cleanlab-tlm
Python client library for Cleanlab Trustworthy Language Model
What it is and what it does
Cleanlab TLM is a Python client for a remote trustworthiness-scoring service that evaluates LLM outputs in real-time. It wraps HTTP calls to Cleanlab's API to assign a confidence score (0–1) to any LLM response, flagging likely hallucinations or incorrect answers by comparing the response against the prompt. The package can either score responses you've already generated from another LLM, or generate and score responses itself by calling a model (GPT, Claude, etc.) on your behalf.
The service is designed for production use in RAG systems, agents, and data-extraction pipelines where incorrect LLM outputs carry real cost. It depends on aiohttp, requests, pandas, tqdm, and a few utility libraries—all standard, low-friction dependencies. You must obtain and configure a free API key before use, and all scoring happens remotely on Cleanlab's servers, not locally.
Use it for:
- Score responses from your own LLM pipeline before returning them to users, filtering out low-confidence outputs.
- Build a RAG system that flags uncertain retrieval-augmented answers and triggers fallback logic or human review.
- Evaluate data-extraction or tagging tasks where hallucinated field values would corrupt downstream processes.
- Monitor agent outputs in real-time to detect when an agent has generated an unreliable response.
- Benchmark the quality of different LLM models or prompts by comparing their trustworthiness score distributions.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Cleanlab TLM scores the trustworthiness of LLM responses in real-time, detecting hallucinations and incorrect outputs by evaluating every response against the original prompt.
Yes, if you need real-time hallucination detection for production LLM systems and can accept a remote API dependency. The package is stable, has low install friction, and covers a genuine gap in local hallucination detection. However, the aging maintenance signal (only 24 stars, no recent activity beyond the last commit date) and reliance on an external API key and service mean you should verify the API's stability and cost structure for your use case before committing to it at scale.
Install
cleanlab-tlm on PyPI
pip
pip install cleanlab-tlmuv
uv add cleanlab-tlmpoetry
poetry add cleanlab-tlmInstalling cleanlab-tlm
Before you install
Low friction install with standard dependencies. The package is marked Production/Stable and supports Python 3.9 through 3.12. Last commit was recent (2025-12-09), but the project shows aging maintenance signals with only 24 repository stars.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for commercial and open-source projects alike.
Quickstart
pip install cleanlab-tlm
from cleanlab_tlm import TLM
tlm = TLM(options={"log": ["explanation"]})
result = tlm.get_trustworthiness_score(
prompt="What's the third month of the year alphabetically?",
response="August"
)
print(result["trustworthiness_score"])
Requires a free API key from https://tlm.cleanlab.ai/ set as the CLEANLAB_TLM_API_KEY environment variable.
Verify before relying
- Actual latency and throughput characteristics for production-scale deployments.
- Whether the API key tier affects rate limits or feature availability.
- Specific LLM models and frameworks the package has been tested with.
- Cost structure for API usage beyond the free tier.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 7 — aiohttp, nest-asyncio, pandas, requests, semver, tqdm, typing-extensions |
| Maintenance | aging — 266 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 163,721/month — #10,564 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cleanlab_tlm-1.1.39-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
cleanlabCleanlab automatically detects and helps fix…
permissive · top 15,000 on PyPI
deepevalDeepEval is an LLM evaluation framework that…
permissive · top 5,000 on PyPI
trulensTruLens instruments LLM applications to trace…
permissive · top 15,000 on PyPI
arize-phoenix-evalsPhoenix Evals provides composable building…
unclear · top 5,000 on PyPI
ragasRagas provides objective metrics, test data…
permissive · top 5,000 on PyPI
trulens-coreInstruments LLM applications with…
permissive · top 15,000 on PyPI
opikOpik is an open-source LLM observability and…
permissive · top 5,000 on PyPI
unbabel-cometEvaluates machine translation quality using…
permissive · top 15,000 on PyPI
llama-indexLlamaIndex is a data framework that connects…
permissive · top 5,000 on PyPI
strands-agents-evalsStrands Evals SDK provides a comprehensive…
permissive · top 15,000 on PyPI