Skip to main content
The Vercel AI SDK (ai) is a TypeScript toolkit for model calls, tools and agents. It emits OpenTelemetry spans that follow the GenAI semantic conventions: one span per call, per step, per model request and per tool call, with the model, token usage and tool names as gen_ai.* attributes. Since Vercel AI SDK 7, you register its OpenTelemetry integration once, and every call is traced. You don’t need a Bronto-specific SDK.
This page was verified on October 22, 2026 with ai 7.0.148, @ai-sdk/otel 1.0.148, @vercel/otel 2.1.3, Next.js 16.3 and Node.js 24. Vercel AI SDK 6 and earlier turned telemetry on per call with experimental_telemetry; in Vercel AI SDK 7 that name is a deprecated alias, and it creates no spans without the registration below.

Prerequisites

  • Vercel AI SDK 7 and Node.js 22 or later
  • A Bronto API key with the Ingestion role (see API Keys)

Set up

Install the Vercel AI SDK’s OpenTelemetry integration and @vercel/otel:
Register both in instrumentation.ts, in the project root or in src/:
instrumentation.ts
Set the exporter in the environment, on Vercel in the project’s environment variables:
The Vercel AI SDK’s spans sit inside the route’s span, next to the fetch spans that @vercel/otel records for each request to the model provider.For more on @vercel/otel on Vercel, including trace context for services outside Vercel, see OpenTelemetry in Vercel Functions.
Use https://ingestion.us.bronto.io for the US region. To send through an OpenTelemetry Collector instead, point OTEL_EXPORTER_OTLP_ENDPOINT at the Collector and see Connect OpenTelemetry to Bronto.

What you get

A generateText call with one tool call produces this trace:
The most useful attributes: See LLM Observability for the field definitions and aggregation examples.

Control what’s recorded

The Vercel AI SDK records prompts, replies, and tool arguments and results by default. Set these per call in telemetry:
telemetry: { isEnabled: false } leaves a call out entirely.
Recorded content is searchable by everyone with access to the dataset. If your prompts or tool results contain personal or regulated data, turn recording off for those calls.

AI Gateway cost and routing

Calls through the Vercel AI Gateway return the gateway’s cost and routing in the provider metadata. To record it on the chat spans, pass providerMetadata: true:
Each chat span then carries ai.response.providerMetadata, a JSON string with the provider’s own usage details and a gateway object: cost in USD, the provider that served the request, and every provider attempt.

Verify in Bronto

Send one request, then open Explore Traces and filter by your service.name. Model calls are the spans named chat <model>. To select them in Log Search:
Sum $gen_ai.usage.input_tokens and $gen_ai.usage.output_tokens grouped by $gen_ai.request.model to see token usage per model, or group by $gen_ai.agent.name to see it per feature.

Troubleshooting

  • Only Next.js spans, no Vercel AI SDK spans: registerTelemetry(new OpenTelemetry()) is missing. In Vercel AI SDK 7, telemetry or experimental_telemetry options alone don’t create spans.
  • No spans at all: check that instrumentation.ts is in the project root (or in src/), and the endpoint and API key header. In Node.js, load the module with --import before the application.
  • Spans missing at the end of a script: call await sdk.shutdown() before the process exits.
  • On Vercel with a trace drain: a trace drain also forwards the spans your code creates, so with a direct export as well they arrive twice. See OpenTelemetry in Vercel Functions.
  • Agents built with eve: eve registers OpenTelemetry itself and traces its model and tool calls. Add a destination as shown in Agents built with eve instead.

References