npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@botsrated/ai-sdk

v0.1.3

Published

Vercel AI SDK payment-client wrap for BotsRated: attachPaymentGuard before pay, plus optional free preflight tools. Not a generation runtime.

Readme

@botsrated/ai-sdk

Install in 3 steps

  1. Install. @botsrated/ai-sdk with the guard is publishing soon (npm 0.1.2 has no guard). From a checkout: npm install in integrations/vercel-ai-sdk (pulls @botsrated/x402-preflight ^0.3.0, on npm).
  2. Attach to your x402 client:
import { attachPaymentGuard } from "@botsrated/ai-sdk";
const guard = attachPaymentGuard(x402Client, { preset: "carefulBuyer", failMode: "open" });
  1. Pick preset (warn advice only is the default; carefulBuyer / strict stop an unobserved payTo) and failMode ("open" default, or "closed").

Default install

Pairs with the Vercel AI SDK (ai). Payment-client wrap only. Not a generation runtime, agent, or model. generateText and streamText stay the SDK's. Not published: from a checkout, npm install in integrations/vercel-ai-sdk (needs @botsrated/x402-preflight ^0.3.0).

import { attachPaymentGuard } from "@botsrated/ai-sdk";
const guard = attachPaymentGuard(x402Client, { preset: "carefulBuyer", failMode: "open" });

Omit preset for advice only. carefulBuyer and strict block an unobserved payTo only when selected. Omit failMode to fail open. Free preflight is https://botsrated.com only. No custody and no payment signing. A tool-level approval helper is deferred: pinned AI SDK 7 deprecates needsApproval (it asks the user; it does not deny).

Token

attach_payment_guard is the same function as attachPaymentGuard.

token, or BOTSRATED_TOKEN when token is omitted, is passed as remotePolicy: { token, failMode } (@botsrated/x402-preflight ^0.3.0 exports normalizeRemotePolicy). A bare token string is never passed. On a remote decision: null, HTTP 503, or transport failure, closed blocks and open reports info. A missing decision is not a pass. A remote pass does not clear a local block. Published @botsrated/x402-preflight 0.2.1 does not accept remotePolicy; 0.3.0 does. A configured token without normalizeRemotePolicy raises and is not dropped.

botsratedPreflight(), botsratedCheck(), and botsratedTools() stay optional and do not attach a guard. Wrap the paying fetch with guard.wrapFetch so the guard knows the URL being paid.

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

const guard = attachPaymentGuard(x402Client, {
  preset: "carefulBuyer", // omit => warn-only advice
  failMode: "open",
  token: process.env.BOTSRATED_TOKEN,
});
const payingFetch = guard.wrapFetch(fetchWithPayment);
const result = await generateText({ model, tools: { ...botsratedTools(), paidTool /* uses x402Client */ }, prompt });

Tools

AI SDK tools for BotsRated. Use them as a pre-payment check before an agent pays an x402 seller.

Status: published on npm as @botsrated/ai-sdk (0.1.2). attachPaymentGuard is not in that release. The source here depends on @botsrated/x402-preflight ^0.3.0. Docs: https://botsrated.com/docs/ai-sdk

npm install @botsrated/ai-sdk ai zod
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 (payTo 0xe903...1aBf), check it.",
  tools: botsratedTools(),            // { botsratedPreflight } – free, no guard
  stopWhen: stepCountIs(3),          // AI SDK 7 also exports isStepCount(3)
});

botsratedTools() returns the AI SDK's ToolSet type, so it type-checks as tools: (or spread into one) under strict TypeScript on AI SDK 5, 6 and 7 (0.1.1 did not on AI SDK 7; fixed in 0.1.2). The single tools are also exported as botsratedPreflight(client) and botsratedCheck(client). stepCountIs works on AI SDK 5, 6 and 7. isStepCount is the AI SDK 7 name (AI SDK 7 needs Node 22+).

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); // { botsratedPreflight, botsratedCheck ($0.001 each after 25 free checks per client IP per UTC day, stops at $0.02) }

The client validates BotsRated's 402 and signs only a copy rebuilt from allowlisted fields: a one-shot EIP-3009 USDC payment on Base to BotsRated's payTo at the published price. A quote asking for Permit2 (extra.assetTransferMethod), carrying payment extensions such as erc20ApprovalGasSponsoring, or a maxTimeoutSeconds above 600 is refused before anything is signed.

Tests: npm test (includes a generateText run with MockLanguageModelV3) and npm run typecheck (compiles the tools-registry usage example under strict TypeScript).