Setup
Choose your integration method based on your needs:| Method | Best for | Setup |
|---|---|---|
| Vercel AI SDK | Fine-grained control over tracing, selective instrumentation | Install packages + add code |
| Vercel Marketplace | Quick setup, automatic tracing of all AI calls | Configure in Vercel dashboard |
Option 1: Vercel AI SDK
Install the Braintrust SDK alongside the Vercel AI SDK. The Braintrust SDK supports Vercel AI SDK v3, v4, v5, and v6.Option 2: Vercel Marketplace
Install the Braintrust integration from the Vercel Marketplace. No package installation required.Trace with Vercel Marketplace
The Vercel Marketplace integration provides automatic tracing for all AI calls in your Vercel applications with minimal setup.Installation steps
- Visit the Vercel Marketplace listing and select Install
- Create or link your Braintrust account
- Select a plan (Free or Pro) and create a project name
- Select Add Drain to configure trace collection
Configure log drain
In the Add Drain panel:- Select Traces and Next
- Choose which Vercel projects to trace (All Projects or specific projects)
- Set the sampling rate for trace collection
Enable OpenTelemetry
In your Next.js project, create aninstrumentation.ts file and call registerOtel. See the Vercel OpenTelemetry docs for details.
Trace with Vercel AI SDK
The Braintrust SDK provides native support for the Vercel AI SDK, automatically tracing AI calls with full input/output logging, metrics, and tool execution.Basic tracing
UsewrapAISDK to wrap the Vercel AI SDK functions (generateText, streamText, generateObject, streamObject).
trace-vercel-ai-sdk.ts
Tool calls
wrapAISDK automatically traces tool call suggestions from the LLM and the tool execution results.
trace-vercel-ai-sdk-tools.ts
Streaming with tools
You can also usestreamText for streaming responses with tool calls:
trace-vercel-ai-sdk-streaming.ts