Skip to main content
LiteLLM provides a unified interface for 100+ LLM providers. Wrap your LiteLLM client with wrapLiteLLM() to trace all calls regardless of provider.

Installation

npm install @zespan/sdk litellm

Setup

import { LiteLLM } from "litellm";
import { zespan } from "@zespan/sdk";

zespan.init({ apiKey: process.env.ZESPAN_API_KEY! });

const litellm = zespan.wrapLiteLLM(new LiteLLM());

Example

const response = await litellm.completion({
  model: "gpt-4o",
  messages: [{ role: "user", content: "What is observability?" }],
});

What gets captured

FieldDetails
ModelThe model string passed to LiteLLM (e.g. gpt-4o, claude-sonnet-4-6, gemini/gemini-2.5-flash)
Input tokensFrom LiteLLM’s normalized usage field
Output tokensFrom LiteLLM’s normalized usage field
CostFrom LiteLLM’s _hidden_params.response_cost if available, otherwise token-based
LatencyTotal call duration
LiteLLM normalizes provider responses. If a provider returns cost data, LiteLLM exposes it in _hidden_params.response_cost — Zespan uses this when available for more accurate cost attribution.