Olivia x420Olivia x420
x402 Payment Protocol for AI Agents

HTTP 402 for APIs.
Olivia AI agents that pay.

Enable autonomous AI agents to pay for services using USDC on BNB. One line of code for sellers, seamless payments for buyers.

Get started with Oliviax402

https://github.com/LolyxMoon/Oliviax402

Zero Payment Logic

Single middleware line. Your API routes stay clean—no payment code, no accounts, no subscriptions.

Instant Settlement

Built on BNB and Base. Near-zero fees, sub-second verification, instant USDC settlement.

Open Standard

Built by Coinbase. Backed by Google, AWS, Cloudflare, and Visa. Chain-agnostic protocol.

Simple to implement

Three steps to enable AI agent payments

1

Configure middleware

Set recipient wallet address
Configure protected routes
Set price per request
// server.ts
import express from "express";
import { paymentMiddleware } 
  from "x402-express";

const app = express();

app.use(
  paymentMiddleware(
    process.env.WALLET_ADDRESS,
    {
      "GET /api/weather": {
        price: "$0.01",
        network: "base-sepolia"
      },
      "POST /api/analyze": {
        price: "$0.05",
        network: "base-sepolia"
      }
    },
    { 
      url: "https://x402.org/facilitator"
    }
  )
);
2

Write your API route

No payment logic needed
Payment verified automatically
Focus on your business logic
// /api/weather/route.ts
import { NextResponse } 
  from 'next/server';

export async function GET(
  request: Request
) {
  // Payment already verified
  // by x402 middleware!
  
  const weatherData = 
    await fetchWeather();
  
  return NextResponse.json({
    temperature: 72,
    condition: 'Sunny',
    humidity: 45,
    paid: true
  });
}
3

AI Agent pays automatically

Detects 402 response
Signs USDC transaction
Retries with payment proof
// eliza-agent/action.ts
import { x402Client } 
  from '@elizaos/plugin-x402';

const payAction = {
  name: "PAY_FOR_SERVICE",
  async handler(runtime) {
    const result = 
      await x402Client({
        privateKey: 
          runtime.getSetting(
            "WALLET_PRIVATE_KEY"
          ),
        url: 'https://api.example.com
          /weather'
      });
    
    return result.data;
  }
};

Built for Oliviax402/ElizaOS Agents

The first AI agent framework with native x402 support. Olivia/ElizaOS agents can autonomously discover, evaluate, and pay for services across the internet using USDC micropayments.

  • 90+ plugins for blockchain, social, AI, and DeFi
  • Persistent memory and learning capabilities
  • Natural language to autonomous payments
  • Deploy on BNB, Base, Ethereum, and more
// character.json
{
  "name": "Olivia",
  "bio": [
    "AI agent that autonomously",
    "pays for data and services",
    "using x402 protocol"
  ],
  "plugins": [
    "@elizaos/plugin-BNB",
    "@elizaos/plugin-x402",
    "@elizaos/plugin-twitter"
  ],
  "settings": {
    "secrets": {
      "WALLET_PRIVATE_KEY": "...",
      "BNB_RPC_URL": "..."
    }
  },
  "actions": [
    "PAY_FOR_SERVICE",
    "DISCOVER_SERVICES",
    "EVALUATE_PRICING"
  ]
}

Real-world use cases

x402 enables new business models impossible with traditional payments

AI Agent Marketplaces

Autonomous agents discover and pay for services like API access, data analysis, and compute without human intervention.

Agent requests → 402 Payment Required → Signs with wallet → Service delivered

Micropayment APIs

Charge $0.001 per request for data feeds, AI inference, or premium content. No minimum charges, no monthly fees.

Pay-per-use pricing as low as 0.1¢ per API call

Content Monetization

Paywall premium articles, videos, or datasets without forcing users to create accounts or subscribe to monthly plans.

One-time payment per article, no tracking, no accounts

Machine-to-Machine Commerce

IoT devices, ML models, and autonomous systems transact directly with each other using trustless, instant payments.

Sub-second settlement, near-zero fees, no intermediaries

Oliviax402

The payment protocol for autonomous AI agents

Built by Coinbase for the AI economy