For the complete documentation index, see llms.txt. This page is also available as Markdown.

Instrument Vercel AI SDK

Recipe — instrument a Vercel AI SDK call to emit traces (via REST).

When to use: Next.js or other Vercel AI SDK users.

Steps (TypeScript)

Post traces via the REST API from your server route:

await fetch("https://stratix.layerlens.ai/api/v1/traces", {
 method: "POST",
 headers: { "X-API-Key": process.env.LAYERLENS_STRATIX_API_KEY!, "Content-Type": "application/json" },
 body: JSON.stringify({ id, name: "ai-sdk-call", inputs, outputs, spans })
});

See also

Last updated

Was this helpful?