OWS Hackathon 2025 · x402 Protocol

Autonomous Payments
for AI Agents.

Open-source SDK for multi-chain x402 settlement. Your agent calls an API — we handle the payment automatically.

QUICK START npx ts-node demo.ts --simulate

How It Works

Five steps from API call to paid response — completely autonomous.

1

AI Agent

Calls performTask()

2

API Server

Returns HTTP 402

3

Policy Engine

Budget + allowlist

4

Settlement

On-chain via Base

5

X-PAYMENT

Proof → 200 OK

Interactive Demo

Watch the full x402 payment flow — no blockchain needed

Agent Configuration

ows-agent-pay — demo.ts
Click "Run Live Demo" to start the x402 payment flow…
Status
Idle
Chain
Payment
Budget Used
$0 / $10
Tx Hash
Total Time

x402 Protocol Flow

The HTTP-native payment protocol for autonomous agents

1

HTTP Request

POST /api/inference HTTP/1.1
Content-Type: application/json

{
  "model": "gpt-4",
  "messages": [...]
}
2

402 Challenge

HTTP/1.1 402 Payment Required

{
  "x402Version": 2,
  "accepts": [{
    "scheme": "exact",
    "network": "base-sepolia",
    "amount": "500000000000000",
    "payTo": "0xDead...8B3c",
    "asset": "ETH"
  }]
}
3

On-Chain Settlement

// BasePaymentAdapter (viem)
const hash = await wallet
  .sendTransaction({
    to: "0xDead...8B3c",
    value: 500000000000000n,
    chain: baseSepolia,
  });
4

X-PAYMENT Retry

POST /api/inference HTTP/1.1
X-PAYMENT: eyJ4NDAyVmVyc2lvbi...

→ HTTP/1.1 200 OK
{
  "status": "success",
  "data": "The answer is 42."
}

Built On & Aligned With

BASE STELLAR CIRCLE STRIPE ARBITRUM ROZO LI.FI

Try It Yourself

Clone, install, and run the demo in under 30 seconds.

Terminal
git clone https://github.com/ASGCompute/ASGCompute-ows-agent-pay.git
cd ASGCompute-ows-agent-pay
npm install
npx ts-node demo.ts --simulate