LiteLLM Integration
Wrap your LiteLLM client with zespan.wrapLiteLLM() and every completion across 100+ providers is traced — model, token counts, and cost from LiteLLM's response_cost field.
LiteLLM is an open-source TypeScript and Python library that provides a unified interface to 100+ LLM providers using the OpenAI API format.

Getting Started
Install the SDK
Install @zespan/sdk alongside litellm.
npm install @zespan/sdk litellmWrap the LiteLLM client
Initialize Zespan and pass your LiteLLM instance to zespan.wrapLiteLLM(). All completion calls across every provider are traced automatically.
import { Zespan } from '@zespan/sdk';
import { LiteLLM } from 'litellm';
const zespan = new Zespan({ apiKey: process.env.ZESPAN_API_KEY });
const litellm = zespan.wrapLiteLLM(new LiteLLM());
const response = await litellm.completion({
model: "gpt-4o",
messages: [{ role: "user", content: "What is observability?" }],
});View traces in Zespan
Open Trace Explorer. Each call appears with provider, model, token counts, and cost pulled from LiteLLM's normalized response.
What's captured automatically
- 100+ providers: any model LiteLLM supports, automatically traced
- Actual model and provider captured per call
- Cost precision: reads response_cost from LiteLLM's _hidden_params when available
- Token counts: input and output tokens from LiteLLM's normalized usage field
- Request latency: total call duration per completion
FAQ
Does Zespan use LiteLLM's cost data or calculate it independently?
Both. Zespan reads _hidden_params.response_cost when the provider supplies cost data. For providers that don't, Zespan calculates cost from token counts and per-model pricing.
Start for free — 10K traces/month, no card needed
LiteLLM integration works on all plans including the free tier.