Vercel AI SDK

Let your model check who it is about to pay

@factline/ai-sdk gives an AI SDK agent six tools that check suppliers, companies, people and x402 payments against official records. Every answer carries its source, and paid answers a signed receipt. Tested with AI SDK 7; works with 4, 5 and 6.

Install

npm install @factline/ai-sdk ai zod

Use

import { generateText, gateway, isStepCount } from 'ai';
import { factlineTools } from '@factline/ai-sdk';

const { text } = await generateText({
  model: gateway('anthropic/claude-sonnet-5-5'),
  tools: factlineTools({ apiKey: process.env.FACTLINE_API_KEY }),
  prompt: 'Can we pay this invoice from Google Ireland Limited, VAT IE6388047V, IBAN IE29AIBK93115212345678?',
  stopWhen: isStepCount(3),
});

console.log(text);

Only some tools: factlineTools({ include: ['supplierInvoiceCheck', 'payGuard'] }). Other options: baseUrl, fetch, timeoutMs. Any AI SDK provider works in place of the gateway, for example anthropic('claude-sonnet-5-5') from @ai-sdk/anthropic.

Tools

ToolWhat it checksPrice
supplierInvoiceCheckBefore paying a supplier invoice: company in its official register, IBAN (valid, same country, matches known_iban from your vendor master), VAT, sanctions on the company and its people, sender email. Verdict pass, review or hold.$0.08
companyCheckA European company in one call: register record (10 countries plus GLEIF), sanctions and PEP on the company, directors and owners, VAT match, US trade lists, Dutch bankruptcy.$0.05
chinaSupplierCheckA Chinese supplier: Unified Social Credit Code, EU/UN/UK/US sanctions, the BIS Entity List and the UFLPA Entity List.$0.03
sanctionsScreenA person or organisation against the EU, UN, UK and US OFAC lists; include "trade" adds US export controls and UFLPA.$0.005
payGuardRight before an x402 payment: is the payTo a wallet the seller lists, is it on the OFAC list, is the seller up and the price sane. allow, review or deny.free
usCompanyA US public company in SEC EDGAR by name, ticker or CIK.$0.01

Keys and payment

Without a key the first 5 paid checks a day are free, and the pay guard is always free. Then either set FACTLINE_API_KEY (a free trial key has 2,000 credits a month, or POST https://factline.dev/v1/key/trial with your work email) or pay per call in USDC with an x402 client. Failed calls are never charged. When free calls run out, a tool returns { error: "payment_required" } with the next step, so the model can tell the user.

Prefer MCP or skills?

The same checks are on the MCP server https://factline.dev/mcp/kyc (AI SDK MCP client setup on /agents) and as agent skills on /skills. Source: npm.