Skip to main content
The Vercel AI SDK integration is available in the PandaProbe TypeScript SDK only. Vercel AI does not provide a Python SDK.

Installation

Install PandaProbe, the Vercel AI SDK, and the provider package used by your model. This example uses OpenAI.

Setup

Wrap the language model with PandaProbe middleware before passing it to generateText, streamText, or other Vercel AI SDK functions that use the language model middleware interface.
TypeScript
The wrapped model remains a normal Vercel AI language model. If there is no active PandaProbe trace, each generation creates a standalone trace. Inside withTrace(), the model call becomes a nested LLM span.

Generate text

TypeScript

Stream text

TypeScript
Streaming captures time-to-first-token, combines text deltas into one span output, and records final usage. The span is finalized if the stream completes, fails, or is cancelled before completion.

What gets traced

Custom span name

The default span and standalone trace name is vercel-ai-generate. Override it when one application uses multiple wrapped models:
TypeScript

Combine with manual tracing

TypeScript
This produces one trace with the Vercel model call nested beneath it as an LLM span.