DOCS
Vercel AI SDK
The Vercel AI SDK can emit OpenTelemetry spans when telemetry is enabled on a call. Those spans go wherever the process OpenTelemetry exporter sends them.
- Create an ingest key.
- Install
@opentelemetry/sdk-nodeand@opentelemetry/exporter-trace-otlp-http. - Start the SDK with the exporter URL set to
https://balerxgate.com/v1/tracesand headerx-balerx-key. - Pass
experimental_telemetry: { isEnabled: true }ongenerateText,streamText, or the agent call your app uses. - Set
gen_ai.agent.namein the telemetry metadata when you want a stable name in the dashboard. Spans whose names or attributes do not look like an agent, tool, or model are stored as other. - Trigger one call and check Runs.
import { NodeSDK } from '@opentelemetry/sdk-node';
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
const sdk = new NodeSDK({
traceExporter: new OTLPTraceExporter({
url: 'https://balerxgate.com/v1/traces',
headers: { 'x-balerx-key': process.env.BALERX_INGEST_KEY },
}),
});
sdk.start();await generateText({
model,
prompt: 'Reply with ok',
experimental_telemetry: { isEnabled: true, functionId: 'onboarding-check' },
});Keep any exporter you already use. Adding this one does not replace it. See fan-out.
