Open-source SDK for multi-chain x402 settlement. Your agent calls an API — we handle the payment automatically.
npx ts-node demo.ts --simulate
Five steps from API call to paid response — completely autonomous.
Calls performTask()
Returns HTTP 402
Budget + allowlist
On-chain via Base
Proof → 200 OK
Watch the full x402 payment flow — no blockchain needed
The HTTP-native payment protocol for autonomous agents
POST /api/inference HTTP/1.1
Content-Type: application/json
{
"model": "gpt-4",
"messages": [...]
}
HTTP/1.1 402 Payment Required
{
"x402Version": 2,
"accepts": [{
"scheme": "exact",
"network": "base-sepolia",
"amount": "500000000000000",
"payTo": "0xDead...8B3c",
"asset": "ETH"
}]
}
// BasePaymentAdapter (viem)
const hash = await wallet
.sendTransaction({
to: "0xDead...8B3c",
value: 500000000000000n,
chain: baseSepolia,
});
POST /api/inference HTTP/1.1
X-PAYMENT: eyJ4NDAyVmVyc2lvbi...
→ HTTP/1.1 200 OK
{
"status": "success",
"data": "The answer is 42."
}
Clone, install, and run the demo in under 30 seconds.
git clone https://github.com/ASGCompute/ASGCompute-ows-agent-pay.git
cd ASGCompute-ows-agent-pay
npm install
npx ts-node demo.ts --simulate