Skip to Content

How do I switch from LangSmith to Rius for the Vercel AI SDK?

Rius traces the Vercel AI SDK through its own integration, so you replace your LangSmith tracing setup with the Rius SDK and one init call. On ai 7 you install @ai-sdk/otel and Rius registers it for you. On ai 5 and 6 you enable telemetry on each call. Each model call then arrives with its model, token usage and a cost that Rius computes.

How it works

The Vercel AI SDK integration is TypeScript only. The Python SDK has none, because the library itself is JavaScript only.

  • ai 7: the AI SDK no longer emits OpenTelemetry spans itself. They come from the official @ai-sdk/otel package, and init() registers it for you. Your application needs no telemetry code. This needs Node 22 or newer, the same floor as ai 7.
  • ai 5 and 6: OpenTelemetry is built in but emits nothing until a call opts in with experimental_telemetry: { isEnabled: true }. Nothing else is installed, and any Node version from 18 works.
  • Counted once: each model call counts once in token and cost totals. The agent span around the calls still shows the run’s total.
  • Cost: you never send a cost value. Rius computes it from the model and token counts, as a list-price estimate in US dollars.

The Migrate to Rius guide describes the general approach: change where traces go rather than rebuild your instrumentation, and run both backends while you evaluate. The LangSmith migration guide maps LangSmith concepts to Rius ones. Its project becomes an agent named by service.name, a run becomes a span, and a thread becomes a session.

Set it up

  1. Install the Rius SDK. For ai 7, add @ai-sdk/otel as well:
npm install @glassflow-ai/rius @opentelemetry/api npm install @ai-sdk/otel
  1. Initialize Rius once at startup, wait for ready, then call the AI SDK as you do today. This example is for ai 7:
import { init } from '@glassflow-ai/rius' import { openai } from '@ai-sdk/openai' import { generateText } from 'ai' const rius = init({ apiKey: 'ri_...', serviceName: 'my-agent' }) await rius.ready // the AI SDK integration is registered before the first call const { text } = await generateText({ model: openai('gpt-4o-mini'), prompt: 'Summarize this ticket', }) await rius.shutdown() // export queued spans before the process exits
  1. On ai 5 or 6, skip @ai-sdk/otel and enable telemetry on each call:
const { text } = await generateText({ model: openai('gpt-4o-mini'), prompt: 'Summarize this ticket', experimental_telemetry: { isEnabled: true }, })
  1. Keep your LangSmith setup running next to Rius for one service or environment while you compare trace counts, token totals and cost on real traffic.

  2. Verify one request. Open the trace in the console and check that the model call span shows the resolved model, token counts and a cost, nested under an agent span. On ai 7, await rius.ready lists vercel-ai. On ai 5 and 6 it does not, even when tracing works, so look for the missing experimental_telemetry setting if no spans appear. If you map LangSmith threads to Rius sessions, the TypeScript SDK sets the session with withSession.

  3. When Rius shows what you need, remove the LangSmith tracing setup from your AI SDK code, such as the wrapAISDK wrapper or a LangSmith OpenTelemetry exporter, and revoke the LangSmith keys.

The Vercel AI SDK integration page has the full setup for each ai version. The integrations overview covers installing and enabling integrations in general.

What you get

  • Run structure: an agent span (invoke_agent) wraps each generateText, streamText, generateObject or streamObject call. Inside it you get a chat span for each model call and an execute_tool span for each tool execution.
  • Content and usage: input and output messages, tool definitions, the resolved model, and token usage including cache reads, cache writes when the AI SDK reports them, and reasoning tokens. Streamed calls carry time to first token.
  • Embedding and rerank: embedding spans appear, and a rerank call is a RERANKER span.
  • Cost: a per-call cost computed by Rius, plus alerts, sessions and users on top of the traces.
  • Privacy controls: captureContent: false and a mask apply to prompts, responses, tool definitions and tool call arguments and results.
  • Not traced on ai 5 and 6: image, speech and transcription calls take no telemetry settings. On ai 7 they are traced.
  • What does not carry over: existing LangSmith traces stay in LangSmith, and Rius starts from the first span you send it.

When something else fits

Rius has no evals, datasets, feedback scores, annotation queues or prompt management. If those are central to your workflow, keep LangSmith for them and run both backends rather than cutting over completely. For a Python service, the Python SDK has no Vercel AI SDK integration, so the LangSmith migration guide is the better starting point.

Still stuck? Get help

Last updated on