How do I switch from LangSmith to Rius for LiteLLM tracing?
Rius traces LiteLLM through one Python integration, so you replace your LangSmith setup with an install and a rius.init() call and keep your litellm.completion calls as they are. Each routed call arrives as a span with the model, token counts and cost. You can run Rius next to LangSmith on one service while you compare, then remove LangSmith.
How it works
The Rius SDK instruments LiteLLM process-wide when you call rius.init(). There is no per-call wrapper to add. Each routed completion becomes a span of kind LLM with the model, token usage and messages. Rius computes cost on its servers from the model and tokens, and the figure is a list-price estimate in US dollars. One extra covers every provider behind the router, so switching providers does not change your tracing.
The code you wrote around LiteLLM maps one to one:
@traceablebecomes@rius.observe, and@traceable(name="Chat Pipeline")becomes@rius.observe(name="Chat Pipeline").@traceable(run_type="tool")becomes@rius.observe(kind=rius.SpanKind.TOOL). Use the TOOL kind for a tool function you trace yourself, because a bareobservemakes a CHAIN span.@traceable(run_type="retriever")becomes@rius.observe(kind=rius.SpanKind.RETRIEVER).- A
thread_idin run metadata becomeswith rius.session(thread_id):. It stamps the session on every span started inside it, including the LiteLLM spans, so you set it once per request. - Other metadata and tags become span attributes, since Rius has no separate tag concept.
The Migrate from LangSmith guide has the full mapping table and the cutover checklist. Migrate to Rius covers the other tools.
Set it up
- Install the LiteLLM instrumentation. The extra does not install
litellmitself, so name it for a fresh environment. A project that already calls LiteLLM keeps its copy.
pip install "glassflow-rius[litellm]" litellm- Swap the LangSmith environment for a Rius key.
# Before: LangSmith
export LANGSMITH_TRACING=true
export LANGSMITH_API_KEY="lsv2_..."
export LANGSMITH_PROJECT="my-agent"
# After: Rius
export RIUS_API_KEY="ri_..."- Call
rius.init()once at startup, before your first LiteLLM call.service_nameis the name Rius groups your agent under, the equivalent of the LangSmith project.
import rius
import litellm
rius.init(service_name="my-agent")
response = litellm.completion(
model="gpt-4o-mini", # or any provider LiteLLM routes to
messages=[{"role": "user", "content": "hi"}],
)- Replace
@traceableand thread metadata in your own functions. This keeps the pipeline span around the LiteLLM call and groups the turns of a conversation.
@rius.observe(name="Chat Pipeline")
def pipeline(question: str) -> str:
return litellm.completion(
model="gpt-4o-mini",
messages=[{"role": "user", "content": question}],
).choices[0].message.content
with rius.session(thread_id): # your own conversation id
pipeline("What does Rius ingest?")-
Run Rius on one service or one environment while the rest keep reporting to LangSmith, and compare trace counts, token totals and cost on real traffic.
-
Verify one traced request in the console: the span shows the model, token counts and a cost.
-
When nothing needs LangSmith, unset
LANGSMITH_TRACING, remove@traceableand any LangSmith client wrappers, and revoke the LangSmith keys.
The LiteLLM integration page covers setup and the blind spots in full. The Integrations page lists every other framework Rius traces.
What you get
After the switch, each routed completion is a span with the model, token usage, messages and cost. Your @rius.observe functions are the parent spans, so the trace keeps the same nested shape you had in LangSmith.
Three details change how the traces read:
- Model names lose the routing prefix. When the prefix names the provider,
openai/gpt-4o-minilands asgpt-4o-miniwith the provideropenai. Update any model filter that matched the prefixed form. - A second span can appear. LiteLLM calls OpenAI and OpenAI-compatible providers through the
openaiclient library. If theopenaiextra is installed too, that call is traced as a second span under the LiteLLM span. The call is still counted once in tokens and cost, and the LiteLLM span shows the run’s total. - A few setups still count a call twice. Streamed calls on some instrumentation versions are one of them; see Still counted twice.
From TypeScript, there is no LiteLLM integration. Calls to a LiteLLM proxy over its OpenAI-compatible endpoint are traced by the OpenAI integration instead, and the model recorded is the one you ask the proxy for.
History stays in LangSmith. Rius starts from the first span you send, and it has no importer for LangSmith runs.
When something else fits
Rius has no evaluators, datasets, feedback queues or prompt registry, so keep LangSmith for those and use Rius for traces, cost and alerts. If you run LiteLLM as a proxy server rather than as a library, the proxy is a separate process: instrument the proxy itself or send its OpenTelemetry traces to Rius. Rius is a hosted service only, so a self-hosted requirement needs a different tool.