Skip to main content
Available for: TypeScript only.

Installation

Usage

Call instrumentVercelAI() once at startup. It returns a telemetry settings object to pass to Vercel AI functions.

Streaming

Pass the same telemetry object to streamText:

Structured output

Using getZespanVercelTelemetry

If you prefer to get the telemetry settings without calling instrumentVercelAI, use getZespanVercelTelemetry directly:
Zespan captures: generateText, streamText, generateObject, tool calls, embed, and embedMany operations. streamObject spans are not currently instrumented — calls made through streamObject will not appear in Zespan even with experimental_telemetry: telemetry set. A tool call is recorded with its name, its arguments (ai.toolCall.args) and its result (ai.toolCall.result); with tool input and output storage turned off for the project, only the name and status are kept. Zespan’s checks for your kind of product read these.