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.
ai7: the AI SDK no longer emits OpenTelemetry spans itself. They come from the official@ai-sdk/otelpackage, andinit()registers it for you. Your application needs no telemetry code. This needs Node 22 or newer, the same floor asai7.ai5 and 6: OpenTelemetry is built in but emits nothing until a call opts in withexperimental_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
- Install the Rius SDK. For
ai7, add@ai-sdk/otelas well:
npm install @glassflow-ai/rius @opentelemetry/api
npm install @ai-sdk/otel- Initialize Rius once at startup, wait for
ready, then call the AI SDK as you do today. This example is forai7:
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- On
ai5 or 6, skip@ai-sdk/oteland enable telemetry on each call:
const { text } = await generateText({
model: openai('gpt-4o-mini'),
prompt: 'Summarize this ticket',
experimental_telemetry: { isEnabled: true },
})-
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.
-
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
ai7,await rius.readylistsvercel-ai. Onai5 and 6 it does not, even when tracing works, so look for the missingexperimental_telemetrysetting if no spans appear. If you map LangSmith threads to Rius sessions, the TypeScript SDK sets the session withwithSession. -
When Rius shows what you need, remove the LangSmith tracing setup from your AI SDK code, such as the
wrapAISDKwrapper 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 eachgenerateText,streamText,generateObjectorstreamObjectcall. Inside it you get achatspan for each model call and anexecute_toolspan 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
RERANKERspan. - Cost: a per-call cost computed by Rius, plus alerts, sessions and users on top of the traces.
- Privacy controls:
captureContent: falseand amaskapply to prompts, responses, tool definitions and tool call arguments and results. - Not traced on
ai5 and 6: image, speech and transcription calls take no telemetry settings. Onai7 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.