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

open-agentpay

v0.4.0

Published

The Open-Source Financial Firewall & Micro-Payment Infrastructure for Autonomous AI Agents (TypeScript SDK)

Readme

open-agentpay

The Open-Source Financial Firewall & Micro-Payment Infrastructure for Autonomous AI Agents (TypeScript / Node.js SDK)

npm version License Documentation

open-agentpay provides autonomous AI agents with non-custodial financial guardrails, automated HTTP 402 Payment Required negotiation, and zero-gas offline cryptographic authorizations (EIP-712 / EIP-3009 transfer with authorization) in native TypeScript.


⚡ Features

  • 🛡️ Non-Custodial Financial Firewall: Local SQLite-backed circuit breakers, 24h rolling budget enforcement, and strict whitelist matrix (EVM networks, token assets, payee addresses, domains).
  • 🔄 Transparent 402 Payment Interceptor: AgentPayClient and createAgentPayFetch automatically intercept HTTP 402 challenges, evaluate local policies, sign authorizations, and replay requests.
  • 🔐 Pre-Signing Safety Guardrails: Zero custom cryptography (backed strictly by viem), automated private key redaction, and strict reservation binding before signing.
  • 🔒 Post-Dispatch Wire Safety: Once a payment signature is transmitted on the wire, upstream 5xx errors or network timeouts never release budget quotas prematurely; automated 3-state reconciler safely unlocks after on-chain expiration.
  • 🤖 AI Framework Ecosystem Native: Drop-in tool wrappers for LangChain.js (@langchain/core), Vercel AI SDK (ai), and Model Context Protocol (@modelcontextprotocol/sdk).

📦 Installation

npm install open-agentpay
# or
pnpm add open-agentpay
# or
yarn add open-agentpay

🚀 5-Minute Quickstart

import { AgentPayClient, LocalSigner } from 'open-agentpay';
import { PolicyConfig, SQLitePolicyEngine, WhitelistMode } from 'open-agentpay/policy';

// 1. Initialize local non-custodial signer (no gas fees paid by buyer)
// Provide your 32-byte hex EVM private key via environment variable
const privateKey = process.env.AGENT_WALLET_KEY ?? '0xYOUR_EVM_PRIVATE_KEY';
const signer = new LocalSigner(privateKey);

// 2. Configure local SQLite budget policy & circuit breaker
const policy = SQLitePolicyEngine.createInMemory(
  new PolicyConfig({
    id: 'agent_firewall',
    name: 'Agent Production Firewall',
    walletAddress: signer.address,
    whitelistMode: WhitelistMode.SIMPLE,
    maxPerTxBaseUnits: 2_500_000n, // Max 2.50 USDC per transaction
    rollingBudget24hBaseUnits: 5_000_000n, // Max 5.00 USDC per 24 hours
  })
);

// 3. Create client with automatic 402 handshake & payment retry
const client = new AgentPayClient({ signer, policy });

// 4. Request paid API endpoint directly
const response = await client.get('https://gate.openagentpay.dev/v1/free/defi/dex-volume', {
  params: {
    chain: 'ethereum',
    excludeTotalDataChart: true,
  },
});

console.log('HTTP Status:', response.status); // 200 OK!
const data = await response.json();
console.log('Result:', data);

🤖 AI Integrations

LangChain.js

import { createPaidTool } from 'open-agentpay/langchain';

const paidTool = createPaidTool({
  name: 'market_data_oracle',
  description: 'Query paid market volume data',
  client,
  func: async (args: { chain: string }, context) => {
    const res = await context!.client!.get('https://gate.openagentpay.dev/v1/free/defi/dex-volume', {
      params: { chain: args.chain },
    });
    return await res.json();
  },
});

Vercel AI SDK

import { paidVercelTool } from 'open-agentpay/vercel-ai';
import { z } from 'zod';

const marketTool = paidVercelTool({
  description: 'Fetch DEX market data with financial firewall protection',
  parameters: z.object({ chain: z.string() }),
  client,
  execute: async ({ chain }, context) => {
    const res = await context!.client!.get('https://gate.openagentpay.dev/v1/free/defi/dex-volume', {
      params: { chain },
    });
    return await res.json();
  },
});

Model Context Protocol (MCP)

import { createPaidMcpFetch, createPaidMcpToolHandler } from 'open-agentpay/mcp';

// Wrap MCP Server tool handlers
const mcpHandler = createPaidMcpToolHandler(client, async (args, context) => {
  const res = await context!.client.get('https://api.example.com/paid-resource');
  return await res.json();
});

// Or use drop-in fetch for MCP Client transports
const mcpFetch = createPaidMcpFetch(client);

📄 License

Apache-2.0 License. See LICENSE for details.