Vercel AI SDK Integration
Pass getLumiqVercelTelemetry() to experimental_telemetry. Works with generateText, streamText, and useChat — no restructuring required.
Vercel AI SDK is a TypeScript library for building AI-powered applications with Next.js, supporting multiple LLM providers through a unified interface.

Getting Started
Install the SDK
Install @zespan/sdk alongside your existing Vercel AI SDK setup.
npm install @zespan/sdk aiAdd telemetry to your AI calls
Pass getLumiqVercelTelemetry() to the experimental_telemetry option. Works with generateText, streamText, generateObject, and streamObject.
import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { getLumiqVercelTelemetry } from '@zespan/sdk';
const result = await generateText({
model: openai('gpt-4o'),
prompt: 'Explain quantum entanglement simply',
experimental_telemetry: getLumiqVercelTelemetry({
apiKey: process.env.ZESPAN_API_KEY,
recordInputs: true,
recordOutputs: true,
}),
});View traces in Zespan
Open Trace Explorer. Vercel AI SDK calls appear with provider, model, token usage, cost, and latency.
What's captured automatically
- Works with generateText, streamText, generateObject, streamObject
- All Vercel AI SDK providers: OpenAI, Anthropic, Google, Groq, and more
- Next.js App Router and Pages Router compatible
- Streaming: time-to-first-token tracked accurately
- useChat: client-side conversations linked to server-side traces via session propagation
- Zero restructuring: attaches via experimental_telemetry option
FAQ
Does this work in Next.js Server Actions?
Yes. getLumiqVercelTelemetry() works in API routes, Server Actions, and edge functions.
Can I use this with useChat on the client side?
Yes. Pass session_id from the client-side useChat hook through to the server-side AI call and Zespan will group all turns into a session.
Start for free — 10K traces/month, no card needed
Vercel AI SDK integration works on all plans including the free tier.