Docs / buying with x402
Buying from AIPayGen with x402
Everything an agent or a reviewer needs to pay for a call, check the receipt, and recover if something goes wrong.
This page is about AIPayGen's own tools. Buying a page from a site that charges AI crawlers works differently (no replay, a delivery check): see for AI companies.
What you pay, where, and to whom
| Paid endpoints | GET or POST https://aipaygen.com/v1/{tool} for 86 paid tools. Example: POST https://aipaygen.com/v1/dns_lookup with {"domain":"example.com"}, $0.001 a call. |
|---|---|
| Prices | Fixed per tool, in USD. Each tool's price is in its 402 quote, in /v1/tools, and in x-payment-info in openapi.json. |
| Network and asset | Base mainnet (eip155:8453), USDC 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913, 6 decimals |
| Pay to | 0xebA22e8CD05Cb72A2F913099D6cCA666DD6D35B0 |
| Scheme | x402 v2, exact (USDC transferWithAuthorization) |
| Facilitator | https://api.cdp.coinbase.com/platform/v2/x402 (verifies and settles every payment; also listed in /.well-known/x402) |
| Free calls | Every caller gets 3 free calls a day on tools priced $0.005 or less. To skip them and always pay, send X-AIPayGen-Free: off. |
| Official X profile | @aipaygen |
The flow
- Call the tool. Unpaid, you get
402 Payment Requiredwith aPAYMENT-REQUIREDheader (base64 JSON quote: price, asset, network, pay-to). - Sign the quote with any x402 client and resend the same request with the
PAYMENT-SIGNATUREheader. - We verify the payment, run the tool, and only if it succeeds settle the payment, then return the result.
Code2 lines
curl -i -X POST https://aipaygen.com/v1/dns_lookup -H "content-type: application/json" \
-H "X-AIPayGen-Free: off" -d '{"domain":"example.com"}' # 402 + PAYMENT-REQUIREDYour receipt
- Response body:
receiptwithpayment: "x402",price,transaction(the settlement on Base) andnetwork. - Header:
PAYMENT-RESPONSE, base64 JSON withsuccess,transactionandnetwork. - Check the transaction on Basescan: a USDC transfer from your wallet to the pay-to address above.
See it working: our live agent buys three calls this way twice a day and lists every receipt (an operator test, labeled as one).
When something goes wrong
| The tool fails | The payment is not settled, so you are not charged. Retry with the same signed payment. |
|---|---|
| Settlement fails | You get a 402 again and no result; nothing is charged. Retry with the same payment or a new one. |
| You paid but the response was lost | Resend the exact same request with the same PAYMENT-SIGNATURE within an hour. You get the same result and receipt again (receipt.replay: true) with no new charge. |
| The same payment sent twice at once | Only one runs and settles; the other is refused (409 PAYMENT_ALREADY_USED) and costs nothing. |
| Anything else | Email hello@aipaygen.com with the transaction hash. |
Never share your private keys. A signed payment is single-use and only pays the quoted amount to the quoted address.