generateText, streamText, generateObject — for calling LLMs from TypeScript apps. Arize AX captures every AI SDK call by ingesting the SDK’s native OpenTelemetry spans through the @arizeai/openinference-vercel span processor.
Prerequisites
- Node.js 18+
- An Arize AX account (sign up)
- An
OPENAI_API_KEYfrom the OpenAI Platform - Vercel AI SDK 3.3 or higher
Launch Arize AX
- Sign in to your Arize AX account.
- From Space Settings, copy your Space ID and API Key. You will set them as
ARIZE_SPACE_IDandARIZE_API_KEYbelow.
Install
Three runtimes are commonly used to register OpenTelemetry alongside the AI SDK:
@opentelemetry/sdk-trace-node (plain Node, shown below), @vercel/otel (Next.js / Vercel edge + Node runtimes), and @opentelemetry/sdk-node. They all wire the same OpenInferenceSimpleSpanProcessor from @arizeai/openinference-vercel — pick whichever matches your runtime. See Troubleshooting for the @vercel/otel setup and the version-pinning rules.Configure credentials
Setup tracing
Run Vercel AI SDK
Expected output
Verify in Arize AX
- Open your Arize AX space and select project
vercel-ai-sdk-tracing-example. - You should see a new trace within ~30 seconds containing an
ai.generateTextparent span wrapping anai.generateText.doGenerateLLM child span (with prompt, response, and token usage attached). - If no traces appear, see Troubleshooting.
Span filter
Other instrumentations registered alongside the AI SDK (@opentelemetry/instrumentation-http, @vercel/otel, Next.js’s built-in tracing) emit POST / GET spans for every fetch, and the AI SDK’s spans nest under those HTTP roots. @arizeai/openinference-vercel exports an isOpenInferenceSpan predicate that drops the non-AI spans:
instrumentation.ts above. The trade-off: filtering removes the HTTP root spans, which orphans the surviving AI SDK spans on the Traces tab (no parent to anchor them) — they remain visible on the Spans tab. If you also need a clean trace tree on the Traces tab, swap the filter for a span processor that promotes the first AI SDK span to root by clearing its parent ID:
OpenInferenceSimpleSpanProcessor in instrumentation.ts:
lru-cache is the only extra dependency: npm install lru-cache.
Troubleshooting
- No traces in Arize AX. Every AI SDK call needs
experimental_telemetry: { isEnabled: true }set on it — without that flag, the SDK never emits spans. Also confirmARIZE_SPACE_IDandARIZE_API_KEYare set in the same shell that runsexample.ts. Enable OpenTelemetry debug logs withexport OTEL_LOG_LEVEL=debugand re-run. 401from OpenAI. VerifyOPENAI_API_KEYis set and has access togpt-5. Swapopenai("gpt-5")for a model your key can call.- Process exits before spans flush. Always
await provider.forceFlush()(orprovider.shutdown()) before the process exits, otherwise trailing spans are dropped. - Next.js / Vercel runtime. Use
@vercel/otel’sregisterOTel(...)instead ofNodeTracerProvider, and pin versions:@vercel/otel@1.xrequires@opentelemetry/*1.x(0.1.xfor unstable APIs);@vercel/otel@2.xrequires@opentelemetry/*2.x(0.2.x). Mismatches surface as silent missing traces. - AI SDK spans orphaned on the Traces tab. Expected when
isOpenInferenceSpanis the only filter — see Span filter above for theRootAwareOpenInferenceProcessorrecipe that promotes the first AI SDK span to root.