skillfed

cleanlab-tlm

Python client library for Cleanlab Trustworthy Language Model

cleanlab-tlm v1.1.39 163.7K downloads/30d#10,564 on PyPI24
Permissive license MIT AGING released

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-tlm

uv

uv add cleanlab-tlm

poetry

poetry add cleanlab-tlm

Installing 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

Development Status :: 5 - Production/StableProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

Tags

llm hallucination detectiontrustworthiness scoring for language modelsllm response evaluationreal-time llm output verificationhallucination detector apiuncertainty estimation for llmsrag response quality scoring
llm-safetyapi-clienthallucination-detection

More Artificial Intelligence packages

Further reading