logo-darkPipe0

Vercel AI SDK

@pipe0/ai-sdk gives agents built with the Vercel AI SDK three tools: one finds people, two enrich people and companies. Your agent calls them like any other tool, and pipe0 queries dozens of data providers behind one API key.

ToolWhat it does
findPeopleRuns a search for people by job title, employer, seniority, job function, company size, and location.
enrichPersonRuns waterfall pipes that find a work email, mobile number, and profile from a LinkedIn URL, an email, or a name and company domain.
enrichCompanyRuns a pipe that adds firmographics for a company domain: description, industry, headcount, revenue, and founding year.

Install

npm install @pipe0/ai-sdk

The package needs ai 5 or later and zod as peer dependencies.

Set your API key

The tools read your pipe0 API key from PIPE0_API_KEY. See Authentication to create one.

.env
PIPE0_API_KEY=your-api-key

To pass the key in code instead, use the apiKey option.

Give your agent the tools

pipe0Tools() returns all three tools. Pass them to generateText or streamText:

Find a person and their work email
import { generateText, isStepCount } from "ai";
import { pipe0Tools } from "@pipe0/ai-sdk";

const { text } = await generateText({
  model: "openai/gpt-5-mini",
  prompt: "Find the CTO of Linear and get their work email.",
  tools: pipe0Tools(),
  stopWhen: isStepCount(10),
});

console.log(text);

The model calls findPeople to find the person, then passes their LinkedIn URL to enrichPerson to get the work email. When a search returns no one, the tool tells the model which filter to drop, so it can widen the search and try again.

To use only some tools, import them one by one:

Pick individual tools
import { enrichCompany, enrichPerson } from "@pipe0/ai-sdk";

const tools = {
  enrichPerson: enrichPerson(),
  enrichCompany: enrichCompany(),
};

Options

Every tool and pipe0Tools take the same options:

OptionTypeDescription
apiKeystringYour pipe0 API key. Defaults to process.env.PIPE0_API_KEY.
environment"production" | "sandbox"sandbox returns free placeholder data while you build. Defaults to production.
needsApprovalbooleanAI SDK 5 and 6 only. Asks the user to approve each call before it runs. Deprecated on AI SDK 7.
clientPipe0A configured client from the TypeScript client.

Credits

In production, every tool call spends credits. findPeople costs about 0.1 credits per person returned. enrichPerson starts at 0.5 credits per value found, and its waterfalls only bill the provider that returned a result. Build against sandbox, which is free.

Approve calls before they run

In agents where users trigger the calls, ask for approval before a tool spends credits. Set toolApproval on generateText, streamText, or ToolLoopAgent:

Ask before enriching a person
const result = await generateText({
  model: "openai/gpt-5-mini",
  prompt: "Get the work email of the CTO of Linear.",
  tools: pipe0Tools(),
  toolApproval: {
    enrichPerson: "user-approval",
  },
  stopWhen: isStepCount(10),
});

findPeople still runs on its own. When the model calls enrichPerson, the result contains a tool-approval-request instead of a tool result. The call runs after you send back the user's approval. See Tool Approvals in the AI SDK docs.

AI SDK 5 and 6 have no toolApproval. On those versions, pass needsApproval: true to the tools.

Keep your key and results safe

Run the tools on your server. Keep PIPE0_API_KEY out of browser bundles, because anyone with the key can spend your credits.

findPeople and enrichPerson return personal contact data. Use it in line with the privacy and marketing rules that apply to you, such as GDPR or CAN-SPAM, and only show results to users who are allowed to see them.

Next steps

These tools cover search and enrichment. For the full catalog, including buying signals and CRM routing, use the TypeScript client or connect your agent to the MCP server.

On this page