Skip to main content

Overview

OpenLIT instruments the official OpenAI SDKs, so TokenLab requests can be monitored by configuring the SDK client with TokenLab’s /v1 base URL.
Type: ObservabilityPrimary Path: OpenAI SDK instrumentationSupport Confidence: Supported OpenAI-compatible observability path

Installation

pip install openlit openai

Environment

export TOKENLAB_API_KEY="sk-your-tokenlab-key"

Example

import os

import openlit
from openai import OpenAI

openlit.init()

client = OpenAI(
    api_key=os.environ["TOKENLAB_API_KEY"],
    base_url="https://api.tokenlab.sh/v1",
)

response = client.chat.completions.create(
    model="claude-sonnet-5",
    messages=[{"role": "user", "content": "Hello from OpenLIT"}],
)

Endpoint Notes

OpenLIT follows the SDK instrumentation path. Chat Completions is the safest integration surface; other TokenLab-native calls depend on whether your OpenLIT/OpenTelemetry setup captures that SDK method or HTTP client.