Getting started / buy x402 pages for agents
Let your agent buy a paid page without a wallet
Some sites charge AI agents with HTTP 402 (x402). paid_fetch pays them from your prepaid AIPayGen credit and hands back the page. No wallet, no signing. You cap the price, we add 15% and a $0.001 fee.
1. Get a key
This tool spends prepaid credit, so it needs an API key: a free key works (no card, no email). Trial and referral credit pay only the $0.001 fee and pages that are free; to buy a priced page, add credit with a top-up.
2. Call it
curl -s -X POST https://aipaygen.com/v1/paid_fetch -H "Authorization: Bearer YOUR_KEY" -H 'content-type: application/json' -d '{"url": "https://aipaygen.com/llms.txt", "max_price_usd": 0.05}'
The answer is JSON: data.status, data.content_type, data.content (the page text), data.truncated and data.payment (what was paid, or that the site asked for nothing). max_price_usd (default 0.05, at most 1) is the most you pay the site. A page above it is refused and nothing is charged.
3. From code
// Node 20+, no packages
const r = await fetch("https://aipaygen.com/v1/paid_fetch", {
method: "POST",
headers: { "content-type": "application/json", authorization: "Bearer " + process.env.AIPAYGEN_KEY },
body: JSON.stringify({ url: "https://example.com/premium-article", max_price_usd: 0.05 }),
});
const { data } = await r.json();
console.log(data.status, data.payment, data.content?.slice(0, 200));
Paid APIs that take input
curl -s -X POST https://aipaygen.com/v1/paid_fetch -H "Authorization: Bearer YOUR_KEY" -H 'content-type: application/json' -d '{"url": "https://paid-api.example.com/quote", "method": "POST", "body": {"symbol": "ETH"}, "max_price_usd": 0.02}'
Set method to POST and send a JSON body. Buying the same request twice within 2 minutes returns the first result instead of paying again.
Know before you buy
Only USDC on Base with the exact scheme is supported. A site that takes the payment but does not return the page cannot be refunded, so buy from sites you trust. Same tool over MCP: paid_fetch at https://mcp.aipaygen.com/mcp. All tools and prices: docs.