Skip to content
@Clawd402

Clawd402

Clawd402

Payment infrastructure for the autonomous agent economy

Clawd402 is a protocol integration layer that enables OpenClaw AI agents to autonomously transact using the x402 payment protocol. Transform agents from read-only information processors into economically autonomous entities capable of purchasing data, subscribing to services, and executing value transfers—without human intervention.

Why Clawd402?

OpenClaw agents possess sophisticated reasoning and task execution capabilities but lack native payment infrastructure. Clawd402 bridges this gap by providing:

  • Instant Payments: 2-second blockchain settlement (vs 2-3 days traditional)
  • Low Costs: ~$0.03 per transaction (vs 3% credit card fees)
  • HTTP-Native: Automatic HTTP 402 discovery and payment handling
  • Multi-Chain: USDC/EURC on Base, Polygon, Solana, Stellar
  • Bidirectional: Make payments AND earn revenue as autonomous agent
  • OpenClaw Integration: Natural language payment instructions

Quick Start

Install

npm install @clawd402/openclaw-plugin
pip install clawd402-python openclaw

Make Your First Payment

import { Agent } from 'openclaw'
import { Clawd402Tool } from '@clawd402/openclaw-plugin'

// Add payment capabilities to agent
const agent = new Agent({
  name: 'research_agent',
  tools: [
    new Clawd402Tool({
      chains: ['base'],
      walletPath: '~/.clawd402/wallet.json',
      approvalPolicy: {
        maxPerTransaction: 100,  // USDC
        dailyLimit: 1000
      }
    })
  ]
})

// Agent autonomously purchases premium data
await agent.run(`
Purchase premium weather data for NYC from https://api.weather.com/premium
Budget: $5 USDC
`)

What happens:

  1. Agent makes HTTP request → receives 402 Payment Required
  2. Clawd402 parses payment details from headers
  3. Constructs USDC transaction on Base chain
  4. Settles payment (~2 seconds)
  5. Retries request with payment proof
  6. Receives premium data

Total time: ~3 seconds | Total cost: $5.03 ($5 + $0.03 gas)

Use Cases

🔍 Autonomous Research Agents

Purchase access to premium data sources, research reports, and paid APIs without human intervention.

agent.run("""
Conduct comprehensive analysis of autonomous vehicle market.
Purchase access to:
- Gartner market report ($25)
- Tesla delivery data API ($15/month)
- Patent database search ($10)
Budget limit: $100 USDC
""")

💰 Earn Revenue as an Agent

Provide services and earn payments autonomously.

const serviceAgent = new Agent({
  name: 'code_reviewer',
  tools: [
    new Clawd402Tool({
      receivePayments: true,
      pricing: {
        'code_review_small': 25,    // <100 lines
        'code_review_medium': 50,   // 100-500 lines
        'code_review_large': 100    // >500 lines
      }
    })
  ]
})

// Agent serves HTTP endpoint with x402 payment gating
serviceAgent.serve({ port: 8080 })

// Other agents can discover and pay for services
// Agent earns USDC, can spend earnings on self-improvement

🤝 Agent-to-Agent Commerce

Autonomous agents discovering, negotiating, and paying for services from other agents.

// Consumer agent
await consumerAgent.run(`
Find a data analysis service that:
- Accepts USDC on Base
- Costs less than $20
- Has rating >4.5 stars
Purchase analysis of my sales dataset.
`)

// Automatically:
// 1. Discovers provider agents in marketplace
// 2. Compares pricing and reputation
// 3. Negotiates payment terms
// 4. Executes payment
// 5. Receives analysis results

📊 Subscription Management

Automated recurring payments for continuous service access.

await agent.run(`
Subscribe to real-time market data at https://api.marketdata.com
for $50/month. Auto-renew if daily usage >80% of free tier.
`)

// Clawd402 handles:
// - Initial payment
// - Monthly renewal reminders
// - Automatic renewal (within approval limits)
// - Cancellation if budget exceeded

Key Features

🔒 Non-Custodial Security

  • Hardware Wallet Support: Ledger, Trezor integration
  • Spending Limits: Per-transaction, daily, monthly caps
  • Approval Workflows: Human-in-the-loop for high-value payments
  • Audit Logging: Complete payment history for compliance
approval_policy:
  auto_approve_below: 10      # USDC
  max_per_transaction: 100
  daily_limit: 1000
  require_approval_above: 50

  trusted_addresses:
    - name: "Weather API"
      address: "0x742d35Cc..."
      auto_approve: true

🌐 Multi-Chain Support

Automatic chain selection based on cost and availability:

Chain Settlement Time Cost per $100 Best For
Base 2 seconds $0.03 General purpose (default)
Polygon 2 seconds $0.02 Cost optimization
Solana <1 second $0.0001 Micropayments (<$1)
Stellar <5 seconds $0.00001 Cross-border transfers
const tool = new Clawd402Tool({
  chains: ['base', 'polygon', 'solana', 'stellar'],
  preferredChain: 'base',
  chainSelection: 'auto'  // Optimizes for cost + speed
})

📡 HTTP 402 Payment Discovery

Automatic detection and handling of payment-required responses:

HTTP/1.1 402 Payment Required
X-Payment-Address: 0x742d35Cc6634C0532925a3b8D...
X-Payment-Amount: 10.00
X-Payment-Currency: USDC
X-Payment-Chain: base
X-Payment-Memo: Premium API access

Clawd402 automatically:

  1. Parses payment details
  2. Validates against policies
  3. Constructs transaction
  4. Settles on-chain
  5. Retries with payment proof

💸 Earnings Management

Agents can earn and spend USDC autonomously:

// Check earnings
const earnings = await tool.getEarnings()
// { base: { usdc: 450.00 }, polygon: { usdc: 125.00 }, total_usd: 575.00 }

// Agent spends earnings to improve capabilities
await agent.run(`
My balance is $575 USDC.
Purchase enhanced static analysis API credits ($100)
to improve code review quality.
`)

// Auto-withdraw to savings
const tool = new Clawd402Tool({
  receivePayments: true,
  autoWithdrawal: {
    threshold: 500,      // When balance > $500
    destination: '0x...',
    retainAmount: 50     // Keep $50 for operations
  }
})

Performance Benchmarks

Settlement Speed Comparison

Payment Method Settlement Time Cost per $100 Cost per $10
Clawd402/x402 2-5 seconds $0.03 $0.03
Credit Card 2-3 days $3.00 (3%) $0.30 (3%)
ACH Transfer 3-5 days $0.25-$1.50 $0.25-$1.50
Wire Transfer 24-48 hours $15-$50 $15-$50
Stripe 2-7 days $3.20 $0.59

Economic Advantages:

  • 99% lower fees than credit cards for $100+ transactions
  • 98% faster settlement than ACH
  • Micropayments economically viable ($0.10 transactions cost $0.03 = 30% vs 330% credit card)

Throughput

  • Per-Agent Capacity: 10 payments/second per chain
  • System-Wide: 1M+ payments/second (across all chains)
  • Current x402 Volume: 15M+ transactions total (as of March 2026)

Documentation

Examples

Explore complete examples in our examples repository:

Ecosystem

Agent Service Marketplace

Discover and monetize agent services:

  • Register Your Service: List your agent and start earning
  • Reputation System: Track reviews and ratings
  • Service Discovery API: Programmatic service discovery

x402 Protocol Partners

API providers accepting x402 payments:

  • Weather APIs: Premium weather data and forecasts
  • Financial Data: Real-time market feeds, analytics
  • Research Databases: Academic papers, market reports
  • AI Models: Specialized model API access
  • Become a Provider: Accept x402 payments

Community

Support

License

MIT License - see LICENSE file for details.


Transform your OpenClaw agents into economically autonomous entities. Get Started →

Popular repositories Loading

  1. x402-rs x402-rs Public

    Forked from x402-rs/x402-rs

    x402 payments in Rust: verify, settle, and monitor payments over HTTP 402 flows

    Rust

  2. nix-openclaw nix-openclaw Public

    Forked from openclaw/nix-openclaw

    Packages OpenClaw for nix.

    Nix

  3. .github .github Public

Repositories

Showing 3 of 3 repositories

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…