# AI tracing: Vercel AI SDK

generateText, streamText and agents in the AI SDK, with any model provider it supports.

## 1. Turn telemetry on per call

The AI SDK emits spans through the OpenTelemetry setup your service already runs. functionId names the run in PowerTraces.

```
const result = await generateText({
  model,
  prompt,
  experimental_telemetry: { isEnabled: true, functionId: 'support-reply' },
})
```

## 2. Next.js: register OpenTelemetry

In Next.js, register it in instrumentation.ts and set the exporter variables from Connect.

```
// instrumentation.ts
import { registerOTel } from '@vercel/otel'

export function register() {
  registerOTel({ serviceName: 'storefront-ai' })
}
```

Prompts and answers are recorded by default; set recordInputs and recordOutputs to false in experimental_telemetry to send counts and timings only.

## Prompts and answers

Most libraries send only counts and timings until you turn content on. When you do, PowerTraces keeps it, masks personal data, or drops it, as set in AI › Settings for each workspace.

## Check it works

Make one model call, then open the AI page: the run appears within a minute. Open it to see each step in the Agent tab.

## Other providers

- [Claude](https://powertraces.com/docs/ai/claude)
- [OpenAI / ChatGPT](https://powertraces.com/docs/ai/openai)
- [Gemini](https://powertraces.com/docs/ai/gemini)
- [.NET AI](https://powertraces.com/docs/ai/dotnet)
- [LangChain · LlamaIndex](https://powertraces.com/docs/ai/frameworks)
- [Amazon Bedrock](https://powertraces.com/docs/ai/bedrock)
- [Other providers](https://powertraces.com/docs/ai/others)

[All documentation](https://powertraces.com/docs)
