Cleanlab TLM API

The TLM API from Cleanlab — 1 operation(s) for tlm.

Operations 1

POST /api/v1/openai_trustworthy_llm/v1/chat/completions Trustworthy chat completion (OpenAI-compatible) #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/cleanlab-tlm-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

cleanlab-tlm-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Cleanlab Codex TLM API
  description: Specification of the Cleanlab data-and-AI trust platform APIs. Covers the Trustworthy Language Model (TLM) OpenAI-compatible Chat Completions endpoint, the Codex / Cleanlab AI Platform project validation (guardrail and remediation) endpoint, and the Cleanlab Studio deployed-model REST inference endpoint. All endpoints are HTTPS REST and authenticate with a Cleanlab API key (or project access key) supplied as a Bearer token.
  termsOfService: https://cleanlab.ai/legal/terms-of-service/
  contact:
    name: Cleanlab Support
    email: support@cleanlab.ai
  version: '1.0'
servers:
- url: https://api.cleanlab.ai
  description: Cleanlab platform API
security:
- bearerAuth: []
tags:
- name: TLM
paths:
  /api/v1/openai_trustworthy_llm/v1/chat/completions:
    post:
      operationId: createTrustworthyChatCompletion
      tags:
      - TLM
      summary: Trustworthy chat completion (OpenAI-compatible)
      description: OpenAI-compatible Chat Completions endpoint that returns a standard completion plus a Cleanlab trustworthiness score. Point the OpenAI client base_url at https://api.cleanlab.ai/api/v1/openai_trustworthy_llm/ and the client appends /v1/chat/completions automatically. The trustworthiness score (0-1) is returned in tlm_metadata on the response. Set stream=true to receive the completion as Server-Sent Events; the final SSE chunk carries the tlm_metadata.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
            text/event-stream:
              schema:
                type: string
                description: Server-Sent Events stream of chat completion chunks (stream=true).
        '401':
          description: Invalid or missing API key.
        '422':
          description: Invalid request parameters.
        '429':
          description: Rate limit exceeded.
components:
  schemas:
    TLMMetadata:
      type: object
      description: Cleanlab trustworthiness metadata attached to the completion.
      properties:
        trustworthiness_score:
          type: number
          format: float
          description: Trustworthiness of the response on a 0-1 scale.
          example: 0.9873
        log:
          type: object
          description: Optional extra metadata such as a trust-score explanation.
          additionalProperties: true
    ChatCompletionRequest:
      type: object
      required:
      - model
      - messages
      properties:
        model:
          type: string
          description: Base LLM to wrap, e.g. gpt-4.1-mini, gpt-5.1, gpt-4.1, o3, claude-opus-4-0, claude-sonnet-4-0, nova-pro, and most LLMs that support the Chat Completions API.
          example: gpt-4.1-mini
        messages:
          type: array
          description: Conversation messages in OpenAI Chat Completions format.
          items:
            $ref: '#/components/schemas/ChatMessage'
        temperature:
          type:
          - number
          - 'null'
          format: float
        max_tokens:
          type:
          - integer
          - 'null'
        stream:
          type: boolean
          default: false
          description: When true, the response is delivered as Server-Sent Events.
        extra_body:
          type: object
          description: 'Cleanlab-specific options, e.g. quality_preset and log. Use "log": ["explanation"] to also return a natural-language explanation of the trustworthiness score.'
          additionalProperties: true
    Usage:
      type: object
      properties:
        prompt_tokens:
          type: integer
        completion_tokens:
          type: integer
        total_tokens:
          type: integer
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
          example: chat.completion
        created:
          type: integer
        model:
          type: string
        choices:
          type: array
          items:
            $ref: '#/components/schemas/ChatCompletionChoice'
        usage:
          $ref: '#/components/schemas/Usage'
        tlm_metadata:
          $ref: '#/components/schemas/TLMMetadata'
    ChatMessage:
      type: object
      required:
      - role
      - content
      properties:
        role:
          type: string
          enum:
          - system
          - user
          - assistant
          - tool
        content:
          type: string
    ChatCompletionChoice:
      type: object
      properties:
        index:
          type: integer
        message:
          $ref: '#/components/schemas/ChatMessage'
        finish_reason:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Cleanlab API key (TLM / Studio) or Codex project access key, supplied as a Bearer token in the Authorization header.