AI features shipped with the Vercel AI SDK serve real users in your product. Agent Ping wraps your calls so each one becomes a run record with cost, status and optional quality, attributed to the customer and feature.
A Vercel AI SDK feature lives in your product, called by real users. When the AI bill moves, you need to know which feature and which customer drove it, and when a feature starts returning weaker answers, you want to know before the support queue does.
Start a run and spread withAgentPing into the call. It wires the AI SDK's onFinish callback, so a call lands as one model call plus a row for each tool the model used, and a streamed generation is captured once the stream completes.
npm install @agentping/sdk
import { generateText } from "ai";
import { openai } from "@ai-sdk/openai";
import * as agentping from "@agentping/sdk";
agentping.init({ apiKey: process.env.AGENTPING_API_KEY });
// One run per call, attributed to the customer and feature.
const run = agentping.run("copilot", { customerId: "acme-corp", feature: "summarise" });
const { text } = await generateText({
model: openai("gpt-4o-mini"),
prompt: "…",
...agentping.withAgentPing(run),
});
await run.finish({ status: "success" });
Full setup, environment variables and options are in the Vercel AI SDK docs.
Vercel shows you function invocations and your provider shows you a token total. Neither tells you which feature or customer a call was for, or whether the answers are getting worse. That is what the Agent Ping dashboard is built around.
Each generateText or streamText call lands as a run with the provider and model taken from the AI SDK's response, input and output tokens summed across every step, cached and reasoning tokens when reported, the finish reason and the latency. Agent Ping prices it from a maintained rate card, so the cost column is there without any maths in your code.
Each tool the model called appears on the run with its arguments and result, and a tool that errored is marked as an error. Turn on perStep and a tool-using call shows each model round trip separately, so you can see which step was the expensive one.
Tag the run with customerId and feature and the cost views break down that way: which AI feature in your product costs the most, which accounts drive it, and how both are trending against their baseline.
With scoring on, a sampled share of runs is judged against your rubric, so a weaker answer shows up as a falling line next to the cost line. A call that throws before onFinish never reaches the helper, so finish the run with an error status in your catch block and failures show up beside the rest.
Send one run from Vercel AI SDK and see cost, status and latency. Then add an alert for cost spikes or missed runs.
Step-by-step guide: monitor Vercel AI SDK agents → Spend, cost attribution → Verify, quality scoring → Pulse, live monitoring →