I trace LiteLLM with Traceloop. How do I switch to Rius?
To switch from Traceloop to Rius for LiteLLM, you install the litellm extra, call rius.init, and remove Traceloop.init. Each routed completion then arrives as a span with the model, token usage and cost. The Rius SDK instruments LiteLLM on init, so one extra covers every provider behind the router, and your decorators map to observe wrappers.
How it works
Traceloop’s SDK is OpenLLMetry, which is plain OpenTelemetry. The Rius SDK replaces it with its own LiteLLM integration, which turns on when you call rius.init(). Each completion that LiteLLM routes becomes a span for the model call with the model, token usage and messages. Rius computes the cost from the model and token counts. Costs are list-price estimates in US dollars, and you never send a cost value.
- One extra covers every provider. LiteLLM puts all providers behind one API, so switching the provider you route to leaves your tracing unchanged.
- Run one tracer per process. OpenLLMetry and the Rius SDK instrument the same client libraries with different instrumentors, so running both in one process produces duplicate LLM spans. Remove OpenLLMetry in each service where you add Rius.
- This path is Python only. The LiteLLM integration is Python only, like the LiteLLM library. From TypeScript, calls to a LiteLLM proxy through its OpenAI-compatible endpoint are traced by the OpenAI integration. The model recorded is the one you ask the proxy for.
The Integrations page lists every library and framework the SDK covers. Migrate to Rius compares the ways in from other tools.
Set it up
-
Install the instrumentation for LiteLLM. The extra installs the instrumentation, not
litellmitself, so the package is named here for a fresh environment. A project that already calls LiteLLM has it.pip install "glassflow-rius[litellm]" litellm -
Replace the Traceloop setup with
rius.init. Delete theTraceloop.init(...)call and theTRACELOOP_API_KEY,TRACELOOP_BASE_URLandTRACELOOP_HEADERSvalues from your deployment. Your LiteLLM calls stay as they are.import rius import litellm rius.init(api_key="ri_...", service_name="my-agent") response = litellm.completion( model="gpt-4o-mini", # or any provider LiteLLM routes to messages=[{"role": "user", "content": "hi"}], )service_nametakes the place of Traceloop’sapp_nameand names the agent your traces are grouped under. -
Swap your OpenLLMetry decorators for
observe. A bareobservemakes a generic step, so@workflowand@taskbecome@rius.observe(name=...). Agents and tools need a kind, so Rius shows them as agents and tools:import rius from rius import SpanKind @rius.observe(kind=SpanKind.TOOL, tool_name="lookup_weather") def lookup_weather(city: str) -> str: ... @rius.observe(kind=SpanKind.AGENT, agent_name="weather_agent") def weather_agent(city: str) -> str: ...A conversation id from
@conversationorset_conversation_idbecomeswith rius.session(cid):. A user id you set through association properties becomeswith rius.user(uid):, which stampsuser.idon every span in scope. -
Verify one request. 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 another provider and the comparison appears in model analytics.
-
Move one service at a time while the rest still report to Traceloop. The Traceloop migration guide has the full concept mapping and a cutover checklist.
What you get
- A span per model call. Each routed completion carries the model, token usage, messages and a server-side cost.
- Model names without the routing prefix. When the prefix names the provider,
openai/gpt-4o-minilands asgpt-4o-miniwith the provideropenai. Update any model filters that matched the prefixed form. - New span names. Unnamed agent and tool spans are called
invoke_agent <name>andexecute_tool <name>, where OpenLLMetry used<name>.agentand<name>.tool. Workflow and task spans use their plain names instead of<name>.workflowand<name>.task. Update saved searches that match on span names. - Calls counted once. LiteLLM calls OpenAI and OpenAI-compatible providers through the
openaiclient library. If theopenaiextra is installed too, that client call is traced as a second LLM span under the LiteLLM span. Tokens and cost are still counted once, and the LiteLLM span shows the run’s total. A few setups, such as streamed calls on some instrumentation versions, are still counted twice. - Sessions and users. Traces group by
session.idand byuser.idonce you set them withrius.sessionandrius.user.
When something else fits
- If you want no code change, keep OpenLLMetry and re-point its exporter at Rius. In Python this switches off Traceloop’s platform client, so
get_prompt(), guardrails, feedback, datasets and experiments stop working. The Traceloop migration guide covers that path. - Rius has no monitors, evaluators, guardrails, prompt registry, datasets or experiments. If you rely on those, keep Traceloop for them and send traces to both backends through a Collector.
- If you run LiteLLM as a proxy server, the proxy is a separate process. Instrument the proxy itself or send its OpenTelemetry traces to Rius.