BotsRated

BotsRated Tools For The Vercel AI SDK

@botsrated/ai-sdk gives an AI SDK agent a pre-payment check for x402 sellers. Before the agent pays, the tool returns what BotsRated last measured about the seller: an unpaid, signed check with status, whether the 402 was valid, latency, and the observed price and payTo. BotsRated covers 4,514 x402 seller hosts on Base.

Install

npm install @botsrated/ai-sdk ai zod

Requires ai 5 or later and zod 3.25.76+ or 4.1.8+. It depends on @botsrated/x402-preflight.

Free Preflight

import { generateText, stepCountIs } from "ai";
import { botsratedTools } from "@botsrated/ai-sdk";

const { text } = await generateText({
  model: "openai/gpt-5-mini",
  prompt: "Before paying https://blockrun.ai/api/v1/chat/completions, check the seller with BotsRated.",
  tools: botsratedTools(), // { botsratedPreflight }, free
  stopWhen: stepCountIs(3), // AI SDK 7 also has isStepCount(3)
});

stepCountIs works on AI SDK 5, 6 and 7. AI SDK 7 (Node 22+) also offers isStepCount.

botsratedPreflight takes url (seller URL or host) and, optionally, payTo, network and amount from the 402 option the agent plans to pay. With payTo it also returns decision.action: allow, warn or block (for example, a payTo never seen for that host warns by default). covered: false means BotsRated has no data for the host; that is not a judgment of the seller. It calls the free GET /v1/preflight.

Opt-In Paid Check, Capped By A Budget

import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { BotsRatedClient, botsratedTools } from "@botsrated/ai-sdk";

const x402 = new x402Client();
registerExactEvmScheme(x402, { signer }); // your signer, e.g. a viem account
const client = new BotsRatedClient({ paid: { budgetUsd: 0.02, x402Client: x402 } });
const tools = botsratedTools(client); // adds botsratedCheck

Needs @botsrated/ai-sdk 0.1.2 or later. The client checks BotsRated's 402 and signs only a copy rebuilt from allowlisted fields: one EIP-3009 USDC payment on Base to BotsRated's payTo at the published price. It refuses a quote that asks for Permit2 (extra.assetTransferMethod), carries payment extensions such as erc20ApprovalGasSponsoring, or sets maxTimeoutSeconds above 600, before anything is signed.

botsratedCheck calls /v1/check: $0.001 USDC on Base per call after the first 25 per day, which are free. It stops when the budget you set is spent and reports remainingUsd. See pricing.

Guard Every Payment

Tools only run when the model calls them. To check every x402 payment, use createPaymentGuard from @botsrated/x402-preflight/payment-guard (0.2.1) on your x402Client.

Notes

Results are measured facts, not endorsements. Seller-supplied text is passed back as data: the seller's own words; we don't check it. How checks work: methodology. Source: GitHub.