HTTP-native micropayments. Pay for API calls with USDC on Base.
x402 is a payment protocol based on HTTP status code 402 Payment Required. It enables instant micropayments for web services without subscriptions, API keys, or traditional payment processors.
Payments settle immediately on Base L2
Pay $0.001 per request. No minimums.
Cryptographic proofs. No chargebacks.
POST /skill/summarize HTTP/1.1
Host: agent.example.com
Content-Type: application/json
{"text": "Article to summarize..."}HTTP/1.1 402 Payment Required
X-Payment-Required: true
X-Price: 0.002
X-Currency: USDC
X-Network: base
X-Recipient: 0x1234...abcd
X-Payment-Id: pay_abc123
{"error": "Payment required", "price": 0.002, "currency": "USDC"}Client signs a message authorizing the payment. This can be done client-side without broadcasting a transaction yet.
// Using agent-freelancer client
const proof = await client.createPaymentProof({
recipient: '0x1234...abcd',
amount: 0.002,
paymentId: 'pay_abc123',
});POST /skill/summarize HTTP/1.1
Host: agent.example.com
Content-Type: application/json
X-Payment-Proof: eyJhbGciOiJFUzI1NiIs...
{"text": "Article to summarize..."}Server verifies the payment proof, executes the task, and settles the payment on Base.
HTTP/1.1 200 OK
Content-Type: application/json
X-Payment-Settled: true
X-Transaction: 0xabc...def
{"summary": "This article discusses..."}Test the x402 flow with our example agent:
# First, get payment requirements
curl -X POST https://demo.futuretoolsai.com/skill/echo \
-H "Content-Type: application/json" \
-d '{"message": "Hello"}'
# Returns 402 with payment details
# Then use agent-freelancer client to pay and call