@voidly/pay
v0.1.6
Published
Voidly Pay SDK — agent-to-agent payments for AI agents. Sign envelopes, settle transfers, run x402 paywalls, verify webhooks.
Maintainers
Keywords
Readme
@voidly/pay
The marketplace AI agents browse for paid HTTP services. Pay any of 17+ paid endpoints for <$0.01 using one Ed25519 keypair. List your own paid endpoint in 60 seconds. Settles in <200ms via x402 + USDC on Base mainnet.
npm install @voidly/pay30-second tour
import { VoidlyPay } from "@voidly/pay";
const pay = await VoidlyPay.create(); // mints + persists keypair
console.log("DID:", pay.did); // did:voidly:...
await pay.faucet(); // 10 free credits
// Browse the marketplace — 17 paid endpoints + N third-party listings
const r = await fetch("https://api.voidly.ai/v1/pay/marketplace");
const mp = await r.json();
mp.items.slice(0, 5).forEach(i =>
console.log(`${i.name.padEnd(40)} $${i.pricing.amount_usdc}`)
);
// Pay any paid endpoint via auto-x402
const w = await pay.fetchWithPay(
"https://api.voidly.ai/v1/pay/wiki?title=Alan%20Turing",
undefined,
{ maxAmount: 0.005 },
);
const receipt = await w.json();
console.log(receipt.extract.slice(0, 200));That's it. The SDK signs the envelope, the server returns a 402 with a Voidly-signed quote, the SDK transfers credits and retries — all in one round-trip.
Pay anything that returns 402
const r = await pay.fetchWithPay(
"https://api.voidly.ai/v1/pay/extract",
{
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ url: "https://arxiv.org/pdf/2507.14183.pdf" }),
},
{ maxAmount: 0.01 },
);
console.log((await r.json()).text_length);List your own paid endpoint
await pay.createListing({
name: "My Paid API",
tagline: "Pay 1¢ for X, get Y signed.",
url: "https://my-api.example.com/expensive",
amount_usdc: 0.01,
category: "data",
tags: ["json", "agents"],
});
// Now appears at /v1/pay/marketplace, every Voidly-aware agent sees it.Or browser-only (no install): voidly.ai/pay/list-your-service.
Run a paid endpoint (Express / Hono / any web-fetch handler)
Express:
import express from "express";
import { VoidlyPay, x402Express } from "@voidly/pay";
const app = express();
const pay = await VoidlyPay.create();
app.get("/expensive", x402Express({ pay, amount: 0.01 }), (req, res) => {
res.json({ data: "the goods", paid_by: req.voidlyPayment.payer_did });
});
app.listen(3000);Hono / Vercel / Cloudflare Workers:
import { Hono } from "hono";
import { VoidlyPay, x402Hono } from "@voidly/pay";
const app = new Hono();
const pay = await VoidlyPay.create();
app.get("/expensive", x402Hono({ pay, amount: 0.01 }), (c) =>
c.json({ data: "the goods" }),
);Any web-fetch handler:
import { withX402 } from "@voidly/pay";
export default {
fetch: withX402({ pay, amount: 0.01 }, async (req) => {
return new Response(JSON.stringify({ data: "the goods" }));
}),
};What you can do
| Primitive | Use case | Method |
|---|---|---|
| Marketplace | List + browse paid services | pay.createListing(...), fetch('/v1/pay/marketplace') |
| Pay any URL | Auto-x402 client | pay.fetchWithPay(url, init, { maxAmount }) |
| Direct transfer | One-shot payment | pay.transfer({ to, amount }) |
| Batch | Pay many atomically | pay.batchTransfer([...]) |
| Escrow | Conditional hold | pay.openEscrow({ to, amount, deadlineHours }) |
| Stream | Per-token / per-second metering | pay.openStream({ provider, budget }) |
| Subscription | Recurring charge | pay.subscribe({ provider, amountPerPeriod, periodSeconds }) |
| x402 quote | Server-side paywall | pay.createQuote({ resource, amount }) |
| x402 verify | Server-side verify | pay.verifyPayment({ payment_header }) |
| Webhooks | Push notifications | pay.subscribeWebhook({ url, events }) |
| Trust check | Pre-flight 6-check report | pay.healthCheck() (incl. on-chain vault read) |
What's in the marketplace today (Voidly's 17 paid endpoints)
| Endpoint | Price | What it does |
|---|---|---|
| voidly_hash | $0.001 | SHA-256/512 + signed receipt |
| voidly_timestamp | $0.001 | Proof-of-existence (OpenTimestamps-style, <200ms) |
| voidly_random | $0.001 | Signed CSPRNG bytes |
| voidly_qr | $0.001 | QR-code PNG of any text/URL |
| voidly_wiki | $0.001 | Wikipedia summary + signed citation |
| voidly_exchange | $0.001 | Fiat/crypto exchange rates |
| voidly_markdown | $0.001 | HTML → clean markdown (10x reduction) |
| voidly_meta | $0.001 | URL metadata (og + title + canonical) |
| voidly_extract | $0.01 | PDF/document → plain text |
| voidly_scrape | $0.01 | Fetch any URL + Voidly-signed receipt |
| voidly_fetch | $0.05 | Country-pinned fetch via 37+ probe network |
| probe_attest | $0.005 | Multi-vantage signed reachability proof |
| Plus 5 research SKUs (forecast, claim-verify, incident-summary, agent-discover, incidents-export) |
Live machine-readable catalog: api.voidly.ai/v1/pay/marketplace.
Webhook signature verification
import { verifyWebhookSignature } from "@voidly/pay";
app.post("/voidly-webhook", async (req, res) => {
const ok = await verifyWebhookSignature({
body: req.rawBody,
signatureHeader: req.headers["x-voidly-signature"],
secret: process.env.VOIDLY_WEBHOOK_SECRET!,
});
if (!ok) return res.status(401).end();
});Configuration
const pay = await VoidlyPay.create({
apiUrl: "https://api.voidly.ai", // override for self-hosted
secretKey: existingKey, // bring your own Ed25519 key
defaultExpiryMinutes: 30,
});Keys auto-persist to:
- Browser:
localStorage["voidly-pay-keypair-v1"] - Node:
~/.voidly-pay/keypair.json(mode 0600) - Or pass a custom
KeyStorageimplementation
Why agents use this
| Problem | Voidly Pay solves it | |---|---| | Need to add payment to your agent service | x402 middleware ships for Express, Hono, FastAPI, Flask, any web-fetch handler | | Need to discover paid services | One install → 17 endpoints + open self-serve marketplace | | Don't want to manage 10 API keys | One Ed25519 keypair, one wallet, every paid endpoint works | | Don't trust the agent's payment claims | Every receipt is Ed25519-signed by Voidly. Verifiable offline. | | Need country-attested fetch | 37+ probe network, signed (URL, country, ASN, probe-DID) |
Honest disclosure
The Voidly Pay vault on Base mainnet (0xb592512932a7b354969bb48039c2dc7ad6ad1c12, Sourcify-verified) currently holds $4 USDC. We have approximately zero sustained external paying users yet. Live reserves at voidly.ai/pay/proof.
We opened the marketplace before the demand exists because we believe agent adoption is gated on discoverability, not on payment-rail UX.
Framework adapters
- MCP (Claude Desktop, Cursor, Windsurf, Cline, Continue, Zed, Goose):
npx @voidly/pay-mcp— 42 tools - Vercel AI SDK:
npm install @voidly/pay-vercel-ai - CLI (shell, cron, CI):
npm install -g @voidly/pay-cli
Links
- Marketplace JSON
- /pay/install — one-click MCP install (any client)
- /pay/marketplace — visual browse
- /pay/list-your-service — list in 60s
- /pay/claim — free 10-credit faucet
- /pay/proof — live reserves dashboard
- /pay/for-builders
- Voidly Pay landing
Keywords
x402 · agent payments · typescript sdk · usdc · base mainnet · signed receipts · agent marketplace · pay per call · micropayments · express x402 · hono x402 · vercel ai sdk · cloudflare workers · langchain agent payments · crewai payments · llamaindex tools · pydantic-ai tools · autogen extensions · claude code · cursor · windsurf
License
MIT
