Are you TokenMaxxing hard enough? Find out in less than a minute →

LiteLLM

One patch covers every provider LiteLLM routes to, with correct per-provider attribution.

LiteLLM gives you one unified interface across many model providers. TokenJam’s LiteLLM patch mirrors that. A single call captures every request LiteLLM routes, and attributes each span to the right provider.

Setup

from tokenjam.sdk.integrations.litellm import patch_litellm

patch_litellm()

Call it once at startup.

Coverage

patch_litellm() captures everything LiteLLM routes to (OpenAI, Anthropic, Bedrock, Vertex, Cohere, Mistral, Ollama, and more) with correct per-provider attribution on each span. If you route through LiteLLM, this one patch is all you need. You do not also install the individual provider patches.

Avoiding double-counting

LiteLLM often calls a provider’s own client under the hood, and tj may patch that client too. To keep one request from producing two spans, the LiteLLM patch suppresses the inner provider patches while it is active. You get exactly one span per LiteLLM request, attributed to the provider LiteLLM actually chose.

For the provider patches and how the integration tiers fit together, see the Frameworks overview.

Get TokenJam updates