LiteLLM
Trace calls routed through LiteLLM with Rius: one integration covers every provider behind the router.
This integration is Python only, as is the LiteLLM library itself. From TypeScript, calls to a LiteLLM proxy over its OpenAI-compatible endpoint are traced by the OpenAI integration, since you make them with the OpenAI client. The model recorded is the one you ask the proxy for, not whichever provider it routes to.
Setup
pip install "glassflow-rius[litellm]" litellmThe extra installs the instrumentation, not litellm itself, so the
package is named here for a fresh environment. A project that already
calls LiteLLM has it, and pip leaves it untouched. Without it, init()
logs a DependencyConflict and this integration stays off.
import rius
import litellm
rius.init(api_key="gf_...", 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.