Give your AI agents a fetch() that pays. Multi-protocol, multi-chain, open source.
BoltzPay detects whether an API endpoint requires payment, negotiates the best protocol and chain, pays with your credentials, and returns the data. One call. No vendor lock-in.
npm install @boltzpay/sdkDiscover paid APIs, check prices, and get quotes — no credentials needed.
import { BoltzPay } from "@boltzpay/sdk";
const agent = new BoltzPay({});
const quote = await agent.quote("https://invy.bot/api");
console.log(quote.amount.toDisplayString(), quote.protocol); // "$0.05" "x402"Add Coinbase CDP credentials to enable automatic payments.
import { BoltzPay } from "@boltzpay/sdk";
const agent = new BoltzPay({
coinbaseApiKeyId: process.env.COINBASE_API_KEY_ID,
coinbaseApiKeySecret: process.env.COINBASE_API_KEY_SECRET,
coinbaseWalletSecret: process.env.COINBASE_WALLET_SECRET,
});
const response = await agent.fetch("https://invy.bot/api");
const data = await response.json();- Budget engine — Daily, monthly, and per-transaction spending limits. Payment events and full spending history. No other x402 client gives you this level of control over what your agent spends.
- MCP-ready — Give Claude a payment wallet in 30 seconds with
npx @boltzpay/mcp. 7 tools, zero code. - Protocol-agnostic — x402, L402, and whatever comes next. Your code doesn't change when the ecosystem does.
Give Claude the ability to discover and pay for APIs.
Step 1: Explore (no keys)
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"boltzpay": {
"command": "npx",
"args": ["-y", "@boltzpay/mcp"]
}
}
}Claude can now discover APIs, check prices, and get quotes — without any credentials.
Step 2: Enable payments
Add Coinbase credentials and a daily spending limit:
{
"mcpServers": {
"boltzpay": {
"command": "npx",
"args": ["-y", "@boltzpay/mcp"],
"env": {
"COINBASE_API_KEY_ID": "your-key-id",
"COINBASE_API_KEY_SECRET": "your-key-secret",
"COINBASE_WALLET_SECRET": "your-wallet-secret",
"BOLTZPAY_DAILY_BUDGET": "5.00"
}
}
}
}7 MCP tools available: fetch (pay and retrieve), quote (check cost), check (detect payment requirement), budget (show remaining budget), history (list recent payments), discover (browse compatible APIs), wallet (show addresses and balances).
Control what your agent spends. Budget enforcement is built into the SDK — not an afterthought.
const agent = new BoltzPay({
coinbaseApiKeyId: process.env.COINBASE_API_KEY_ID,
coinbaseApiKeySecret: process.env.COINBASE_API_KEY_SECRET,
coinbaseWalletSecret: process.env.COINBASE_WALLET_SECRET,
budget: {
daily: "$5.00",
perTransaction: "$0.50",
},
});
// Payments that exceed limits are blocked automatically
agent.on("budget:exceeded", (event) => {
console.log(`Blocked: ${event.period} budget exceeded`);
});
// Track every payment
agent.on("payment", (event) => {
console.log(`Paid ${event.amount.toDisplayString()} via ${event.protocol} for ${event.url}`);
});
// Check remaining budget anytime
const budget = agent.getBudget();
// { dailySpent: Money, dailyLimit: Money, dailyRemaining: Money, ... }| Protocol | Backed by | Payment | Detection | Status |
|---|---|---|---|---|
| x402 | Coinbase | USDC on-chain | 402 status + headers | Live |
| L402 | Lightning Labs | Bitcoin (Lightning) | 402 + L402 header | Live |
The SDK auto-detects which protocol an endpoint uses and handles payment accordingly. x402 works with Coinbase CDP credentials. L402 requires an nwcConnectionString in the config (a Nostr Wallet Connect URI from Coinos, Primal, or any NWC-compatible wallet).
BoltzPay supports EVM (Base mainnet and Base Sepolia testnet) and SVM (Solana) when endpoints accept those chains. Most current endpoints use EVM. When a server accepts multiple chains, the SDK auto-negotiates the best option based on your wallet balances and network conditions.
Override chain selection with the preferredChains config option:
const agent = new BoltzPay({
coinbaseApiKeyId: process.env.COINBASE_API_KEY_ID,
coinbaseApiKeySecret: process.env.COINBASE_API_KEY_SECRET,
coinbaseWalletSecret: process.env.COINBASE_WALLET_SECRET,
preferredChains: ["evm"],
});npx @boltzpay/cli <command>Check if an endpoint requires payment:
boltzpay check https://invy.bot/api
# Protocol: x402 | Price: $0.05 | Chain: BaseFetch and pay:
boltzpay fetch https://invy.bot/api --json
# {"data": {"holdings": [...]}, "payment": {"amount": "$0.05", "protocol": "x402"}}Browse compatible APIs:
boltzpay discover
# 25 endpoints across 5 categories: Crypto Data, Utilities, Demo, Research, Dev ToolsInteractive demo:
boltzpay demo
# Walks you through wallet check, endpoint selection, quote, and optional fetchShow wallet info:
boltzpay wallet
# EVM: 0x1a2b...3c4d (Base) | SVM: 5e6f...7g8h (Solana)Local x402 server for testing payments on Base Sepolia testnet — all public testnet endpoints are currently broken due to a known Next.js middleware bug.
# Terminal 1 — start the test server
cd examples/test-server && npm install && npm start
# Terminal 2 — pay with BoltzPay
boltzpay check http://localhost:4021/api/joke
boltzpay fetch http://localhost:4021/api/jokeSee examples/test-server/README.md for prerequisites and details.
BoltzPay works with any x402 or L402 endpoint. The built-in directory includes 25 verified endpoints (23 x402 + 2 L402) across categories: crypto-data, utilities, demo, research, and dev-tools.
Browse the directory programmatically:
import { API_DIRECTORY, getDirectoryCategories } from "@boltzpay/sdk";
console.log(getDirectoryCategories()); // ["crypto-data", "utilities", "demo", "research", "dev-tools"]
console.log(API_DIRECTORY.length); // 25Or via CLI: boltzpay discover
| Package | Description |
|---|---|
| @boltzpay/sdk | Main SDK — BoltzPay class with fetch, quote, budget, events |
| @boltzpay/core | Domain types, Money value object, error hierarchy |
| @boltzpay/protocols | Protocol adapters (x402, L402) and wallet management |
| @boltzpay/mcp | MCP server for Claude Desktop |
| @boltzpay/cli | Command-line interface and Python bridge |
| @boltzpay/ai-sdk | Vercel AI SDK tools (7 tools) |
BoltzPay works with major AI agent frameworks — TypeScript and Python.
npm install @boltzpay/ai-sdk ai @boltzpay/sdkimport { generateText } from "ai";
import { openai } from "@ai-sdk/openai";
import { boltzpayTools } from "@boltzpay/ai-sdk";
const { text } = await generateText({
model: openai("gpt-4.1"),
tools: boltzpayTools(),
maxSteps: 5,
prompt: "Discover available paid APIs and check prices",
});7 tools: fetch, quote, check, discover, budget, history, wallet. Full docs
pip install langchain-boltzpayfrom langchain_boltzpay import BoltzPayFetchTool, BoltzPayDiscoverTool
tools = [BoltzPayDiscoverTool(), BoltzPayFetchTool()]
result = tools[0].invoke({}) # Discover available APIsRequires Node.js 20+ (the CLI bridge calls npx @boltzpay/cli under the hood). Full docs
pip install boltzpay-crewaifrom boltzpay_crewai import BoltzPayTool
tool = BoltzPayTool()
result = tool._run(command="discover") # Browse paid APIsAlso works natively via MCP — no Python package needed:
from crewai_tools import MCPServerAdapter
from mcp import StdioServerParameters
server_params = StdioServerParameters(
command="npx", args=["-y", "@boltzpay/mcp"],
)
with MCPServerAdapter(server_params) as tools:
agent = Agent(role="Researcher", tools=tools)Install via Settings > Community Nodes in n8n:
@boltzpay/n8n-nodes-boltzpay
4 operations: Fetch, Check, Quote, Discover. Configure Coinbase CDP credentials in n8n's credential manager. Full docs
BoltzPay is available as an OpenClaw skill for ClawHub-compatible agents. See integrations/openclaw/.
- AP2 support — Google's Agent Payments Protocol (tracking spec stabilization)
Detection fails behind corporate/coworking WiFi
Some network proxies intercept HTTP 402 responses or strip payment headers, which prevents x402 detection. If check or quote returns unexpected results, try on a direct connection. Use --debug to inspect raw headers.
See CONTRIBUTING.md for setup instructions and PR guidelines.
MIT — see LICENSE
Created by @leventilo