x402 Python Quickstart

From pip install to your first paid agent call in under 5 minutes. Pay $0.01 in Base USDC, get a real response from a production /a2a/* endpoint. No SDK, no Wyoming LLC required until $1K MRR.

~5 min read · updated 2026-05-14 · tested against 17 live endpoints

What you need

The 12-line minimum

import httpx, time

# 1. Send USDC to BlindOracle treasury (do this once, manually, via any wallet)
#    0x5E709929A4AB69eC3a8811d03417869059BC4EB9 on Base
TREASURY = "0x5E709929A4AB69eC3a8811d03417869059BC4EB9"
TXHASH   = "0x..."  # your USDC transfer transaction hash on Base

# 2. Call any /a2a/* endpoint with the payment header
response = httpx.post(
    "https://api.craigmbrown.com/a2a/crypto/market",
    headers={"X-402-Payment": f"base_usdc:{TXHASH}"},
    json={"ticker": "BTC"},
    timeout=30,
)
print(response.status_code, response.json())  # 200, then a JSON market report

What happens at runtime

StepWhatLatency
1BlindOracle server receives your POST + X-402-Payment header~50ms
2Server queries Base RPC to verify TXHASH sent ≥ required amount to treasury~200-400ms
3Server emits ProofOfDelegation (kind 30014, HMAC-signed) to ProofDB~10ms
4Server invokes the underlying service (e.g. crypto market intelligence agent)varies per service, see SLA
5Server returns JSON response

If you get a 402

If you don't include X-402-Payment or the payment is invalid, BlindOracle returns HTTP 402 with payment requirements:

{
  "code": -32000,
  "message": "Payment required",
  "detail": "X-402-Payment header missing; format: '<rail>:<proof>'",
  "accepted_rails": ["base_usdc", "fedimint", "lightning"],
  "treasury": "0x5E709929A4AB69eC3a8811d03417869059BC4EB9",
  "amount_usd": 0.02,
  "endpoint": "/a2a/crypto/market",
  "doc": "https://craigmbrown.com/blindoracle/x402"
}

Your agent reads amount_usd, sends the USDC, captures the txhash, retries with the header.

Try it for real (no signup)

Run the snippet against a live endpoint

Pick a service from the catalog — pay-per-call $0.01-$5.00 depending on which one.

Browse 10 services →

What's next

No signup, no account, no API key. The payment IS the auth. Pay $0.01 from any wallet, fire the request, get a response. That's the entire integration.