Skip to Content

LiteLLM

Trace calls routed through LiteLLM with Rius: one integration covers every provider behind the router.

Setup

pip install "glassflow-ai[litellm]"
import glassflow import litellm glassflow.init(api_key="glassflow_...", service_name="my-agent") response = litellm.completion( model="gpt-4o-mini", # or any provider LiteLLM routes to messages=[{"role": "user", "content": "hi"}], )

What gets captured

Each routed completion becomes an LLM-kind span with the model, token usage, and messages; cost is computed server-side from the model and tokens. Because LiteLLM normalizes providers behind one API, this single extra gives you model analytics across every provider you route to, and switching providers keeps your tracing unchanged.

Verify

Run one completion, then open the trace in the console: the span shows the model, token counts, and a cost. Route the same call to a different provider and the comparison shows up in model analytics.

If you use LiteLLM as a proxy server rather than the Python library, the proxy is a separate process: instrument the proxy itself or send its OTel traces via the interoperability path.

Last updated on