You use the Vercel AI SDK for streaming generations. Track each generation as an LLM call inside an Apie run.
import { withVercelAiGeneration } from "@apie-sh/sdk";
await apie.withRun({ inputSummary: "Generate response" }, async (run) => {
const result = await withVercelAiGeneration(
apie,
{
runId: run.id,
model: { provider: "openai", name: "gpt-4o" },
inputSummary: "Summarize incident feed",
},
async () => generateText({ model: openai("gpt-4o"), prompt: "Summarize..." }),
);
});
Events: agent.llm.called, agent.llm.completed, agent.llm.failed
What you’ll see
LLM generation events in the run timeline with model provider, name, and input summary.
The Vercel AI SDK is primarily a JavaScript ecosystem. The Python wrapper exists for API parity but is most relevant in JS/TS projects.
Next steps
Custom telemetry
LLM calls and workflow steps.
Integrations hub
All integrations.