Vercel AI SDK
Enrich the spans the Vercel AI SDK already emits so its model calls arrive in Rius as generations, with prompts, responses, models, and token usage.
This integration is TypeScript only. The Python SDK has no Vercel AI SDK integration, because the library itself is JavaScript only.
Setup
npm install @arizeai/openinference-vercel @ai-sdk/otelBoth packages are needed: since ai 7 the AI SDK no longer depends on
OpenTelemetry itself, and its OTel spans come from the @ai-sdk/otel
telemetry integration. @arizeai/openinference-vercel requires Node 22 or
newer; on an older runtime the integration stays inactive and the rest of
the SDK keeps working.
Unlike the other integrations, this one does not patch the library. You enable the AI SDK’s OpenTelemetry integration per call, and Rius transforms the spans it produces:
import { init } from '@glassflow-ai/rius'
import { OpenTelemetry } from '@ai-sdk/otel'
import { openai } from '@ai-sdk/openai'
import { generateText } from 'ai'
init({ apiKey: 'glassflow_...', serviceName: 'my-agent' })
const { text } = await generateText({
model: openai('gpt-4o-mini'),
prompt: 'Summarise this ticket',
experimental_telemetry: { isEnabled: true, integrations: [new OpenTelemetry()] },
})Without the OpenTelemetry integration in the call, the AI SDK emits no
spans, so there is nothing for Rius to transform and the call is invisible.
(On ai 5 and 6, which had OpenTelemetry built in,
experimental_telemetry: { isEnabled: true } alone was enough.)
What gets captured
The AI SDK’s own spans (ai.generateText, ai.streamText, and the
doGenerate / doStream spans beneath them) gain OpenInference attributes, so
they render as LLM-kind generations rather than as unlabelled spans: the model
and provider, the prompt and response text, token usage, and the call settings.
Cost is computed server-side from the model and tokens.
Spans the AI SDK emits for tool calls it makes on your behalf are enriched the same way, so a tool-calling loop arrives as one trace.
Ordering and privacy
The transform runs before the exporting processor, so everything it adds is
covered by your privacy controls:
captureContent: false and a mask apply to the prompt and response
attributes it produces exactly as they apply to manual spans.
Verify
Run one generateText call with telemetry enabled, then open the trace in the
console. The span shows the resolved model, input and output token counts, and
a cost. Wrap the call in observe
to see it nested inside your agent’s run instead of as a standalone trace.
If no spans appear at all, the OpenTelemetry integration from
@ai-sdk/otel is missing from the call: without it the AI SDK emits
nothing. If spans appear but carry no model or cost,
@arizeai/openinference-vercel is not installed or the process is on Node 20
or older. Check the names in await client.ready, which lists the integrations
that attached.