
Research
/Security News
737 Chrome VPN Extensions Linked to Brand Impersonation and Browser Traffic Redirection
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.
@agenticpay/ai-sdk
Advanced tools
Vercel AI SDK helpers for x402 paid tool calls — agents pay per tool invocation in USDC on Solana
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.
npm install @agenticpay/ai-sdk
# peer deps you probably already have:
npm install ai zod
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'",
});
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:
url with the model's parameters.HTTP 402 with payment requirements.X-PAYMENT header.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
The agent only needs USDC — the facilitator's fee_payer covers the SOL gas. For devnet:
Pre-alpha. Devnet validated end-to-end via the agenticpay monorepo.
MIT licensed.
FAQs
Vercel AI SDK helpers for x402 paid tool calls — agents pay per tool invocation in USDC on Solana
We found that @agenticpay/ai-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.