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

@agenticpay/ai-sdk

v0.0.1

Published

Vercel AI SDK helpers for x402 paid tool calls — agents pay per tool invocation in USDC on Solana

Readme

@agenticpay/ai-sdk

Vercel AI SDK helpers for x402 paid tool calls. Wraps paywalled HTTP endpoints into a tools object you can drop straight into generateText, streamText, or streamUI. The model decides when to invoke; this package signs the USDC payment, settles on Solana, returns the result.

Install

npm install @agenticpay/ai-sdk
# peer deps you probably already have:
npm install ai zod

Usage

import { generateText } from "ai";
import { anthropic } from "@ai-sdk/anthropic";
import { createAgenticpayTools } from "@agenticpay/ai-sdk";
import { z } from "zod";

const senderKeypairBytes: number[] = JSON.parse(
  process.env.AGENT_SOLANA_KEYPAIR_BYTES!
);

const tools = await createAgenticpayTools({
  network: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1", // devnet
  rpcUrl: "https://api.devnet.solana.com",
  keypairBytes: senderKeypairBytes,
  paidTools: {
    reverseString: {
      description: "Reverse a string. Costs 0.001 USDC via x402 on Solana.",
      parameters: z.object({ text: z.string() }),
      url: "http://localhost:4021/tools/reverse",
    },
    wordCount: {
      description: "Count words in a string. Costs 0.0005 USDC.",
      parameters: z.object({ text: z.string() }),
      url: "http://localhost:4021/tools/word-count",
    },
  },
});

const { text } = await generateText({
  model: anthropic("claude-opus-4-7"),
  tools,
  prompt: "Reverse 'agenticpay rocks' and count words in 'open source wins'",
});

How it works

createAgenticpayTools() builds an x402Client once per call (cached), hydrates it with the agent's Solana keypair, and wraps fetch with @x402/fetch. Each paid tool becomes a normal Vercel AI SDK tool — the AI SDK layer never sees the payment plumbing.

When the model invokes the tool:

  1. We POST to url with the model's parameters.
  2. Server returns HTTP 402 with payment requirements.
  3. The wrapper signs a USDC payload using the agent's keypair.
  4. Retries with X-PAYMENT header.
  5. Facilitator settles on-chain (~1.5–2 s on devnet).
  6. Server returns the result; we hand it back to the model.

Pointing at a facilitator

Your paywalled endpoints (url above) are typically backed by @agenticpay/mcp-server or any other x402-compatible server. Either self-host with @agenticpay/facilitator or point the resource server at the public devnet facilitator:

FACILITATOR_URL=https://agentpay-facilitator-e9b20a5fee6a.herokuapp.com

Funding the agent

The agent only needs USDC — the facilitator's fee_payer covers the SOL gas. For devnet:

  • SOL: https://faucet.solana.com
  • USDC: https://faucet.circle.com (Solana Devnet)

Status

Pre-alpha. Devnet validated end-to-end via the agenticpay monorepo.

MIT licensed.