X402 Payment-Protected AI Chat

Cryptocurrency-powered access to AI agents using micropayments

What is X402?

X402 is an open protocol for micropayments on the web that uses HTTP status code 402 (Payment Required) to enable automatic cryptocurrency payments. Our X402 Chat client provides seamless access to AI agents with automatic USDC payments - no accounts or subscriptions required.

$0.01 USDC per message
Instant crypto payments
No accounts needed
Getting Started with X402 Chat

Get started with X402 payments in 3 simple steps:

1

Create & Fund Your Wallet

Create a secure wallet and fund it with USDC on Base or Base Sepolia

2

Select an Agent

Choose from published agents or enter a custom X402 agent URL

3

Start Chatting

Send messages and payments are handled automatically

Wallet Setup & Management

Step 1: Create Your Wallet

The X402 client includes an integrated wallet system powered by Coinbase's CDP SDK. Your wallet is created locally and securely stored in your browser.

Wallet Creation Process:

  • • Click the wallet management button in the chat interface
  • • Select "Create Wallet" to generate a new secure wallet
  • • Your wallet address and private key are generated locally
  • • Wallet data is encrypted and stored in browser localStorage
  • • You can export your private key for backup (keep it secure!)

Step 2: Fund with USDC

Add USDC to your wallet to pay for messages. The client supports both Base mainnet and Base Sepolia testnet.

Base Mainnet

Network: Base (Chain ID: 8453)

USDC Contract: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913

Use for: Production usage

Send USDC to your wallet address or use a bridge service

Base Sepolia

Network: Base Sepolia (Chain ID: 84532)

USDC Contract: 0x036CbD53842c5426634e7929541eC2318f3dCF7e

Use for: Testing and development

Agent Selection & Configuration

Choose Your AI Agent

Select from published agents or connect to any X402-compatible agent endpoint.

Option 1: Published Agents

  • • Browse available agents in the dropdown
  • • See agent status, ID, and capabilities
  • • Automatic connection and payment setup
  • • Pre-configured with toolkits and settings

Option 2: Custom URL

  • • Enter any X402-compatible agent URL
  • • Automatic validation (expects 402 response)
  • • Payment requirements extracted automatically
  • • Supports both local and remote agents
Chat Features & Payment Process

Automatic Payments

Pay-per-message with automatic USDC payments. No subscription required.

Cost: Typically $0.01 USDC per message

Payment: Processed before message is sent

Streaming Responses

Real-time streaming responses with payment confirmation

Features: Message history, transaction tracking

Tools: Access to DeFiLlama, Chainlink, and more

Secure & Private

Local wallet storage with cryptographic payment proofs

Security: Local key storage, no server-side wallets

Privacy: No accounts, emails, or personal data required

Multi-Network Support

Switch between Base mainnet and testnet seamlessly

Networks: Base, Base Sepolia

Wallet: Separate wallets per network

AURA X402 Payment Facilitator

Our X402 Payment Facilitator provides the infrastructure for secure payment verification and settlement. It handles the complex cryptographic operations required for X402 protocol compliance.

What is the X402 Facilitator?

The facilitator acts as a payment processor that verifies USDC transactions and generates cryptographic proofs for X402-protected resources. It provides /verify and /settle endpoints that handle the technical complexity of blockchain payment verification.

For Developers & Sellers

If you're building an X402-protected service, you can use our facilitator:

  • • Generate API keys with $AURA tokens (1000+ required)
  • • Get facilitator URL for your middleware
  • • Automatic payment verification and settlement
  • • Support for Base and Base Sepolia networks

Integration Process

  1. 1. Connect wallet with 1000+ $AURA tokens
  2. 2. Generate API key in facilitator dashboard
  3. 3. Configure your X402 middleware:
paymentMiddleware(config, {
  "url": "https://x402-facilitator.aurracloud.com/api/v1/<YOUR_API_KEY>"
})

Facilitator Features

Lightning-fast verification
Enterprise security
Multi-chain support
API Endpoint Reference

For developers who want to integrate X402 payments programmatically, here are the API details:

Published Agents

URL Pattern:

https://x402.aurracloud.com/agent/[agentId]/v1/chat

Method: POST

Payment: ~$0.01 USDC per request

Request Format

{
  "messages": [
    {
      "role": "user", 
      "content": "What is the current price of ETH?"
    }
  ],
  "id": "unique-session-id",
  "userId": "user-identifier",
  "selectedToolkits": ["defillama", "chainlink"]
}

Example Request

curl -X POST https://x402.aurracloud.com/agent/00000000-0000-0000-0000-000000000001/v1/chat \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {
        "role": "user",
        "content": "What is the current price of ETH?"
      }
    ],
    "id": "test-session",
    "userId": "test-user",
    "selectedToolkits": ["defillama"]
  }'
Payment Process

Step 1: Initial Request

When you make a request without payment, you'll receive a 402 Payment Required response:

{
  "error": "Payment Required",
  "payment": {
    "amount": "0.01",
    "currency": "USDC",
    "network": "base-sepolia",
    "receiver": "0x...",
    "instructions": "..."
  }
}

Step 2: Complete Payment

Use an X402-compatible client or wallet to complete the USDC payment. The payment creates a cryptographic proof that can be used to access the protected resource.

Step 3: Access with Payment Proof

Retry your request with the payment proof in the X-PAYMENT header to access the protected content:

{
  "messages": [...],
  "reasoning": "The agent's thought process",
  "toolCalls": [...],
  "usage": {
    "inputTokens": 50,
    "outputTokens": 150,
    "totalTokens": 200
  }
}
Available Agents & Example URLs

Example Agent URLs

  • https://x402.aurracloud.com/agent/00000000-0000-0000-0000-000000000001/v1/chat
  • • Any X402-compatible agent endpoint that returns 402 Payment Required
Supported X402 Clients

Web Clients

  • Built-in Web Client: Use the /x402 route
  • x402-fetch: JavaScript library for browsers
  • Custom implementations: Using X402 protocol spec

Developer Tools

  • x402-axios: Axios adapter for Node.js
  • CDP AgentKit: For AI agents with X402
  • Protocol libraries: Multiple language support
Available Toolkits

When chatting with agents, you can specify which toolkits to enable:

Core Toolkits

  • defillama: DeFi analytics and token data
  • chainlink: Price feeds and market data
  • coinbase: Trading and wallet operations

Specialized

  • • Additional toolkits available based on agent configuration
  • • Custom toolkits for specific use cases
  • • Tool permissions controlled per agent
Network Support & Configuration

The X402 client supports multiple networks with seamless switching. Each network maintains its own wallet instance.

Base Mainnet (Default)

Chain ID: 8453

Currency: USDC

RPC: Base mainnet endpoints

Use for: Production usage with real funds

Base Sepolia Testnet

Chain ID: 84532

Currency: Test USDC

RPC: Base Sepolia endpoints

Use for: Development and testing

Wallet Requirements

To use X402 payments, you need:

Wallet Setup

  • • Compatible wallet (MetaMask, Coinbase Wallet, etc.)
  • • Base or Base Sepolia network configured
  • • Sufficient USDC balance for payments
  • • Small amount of ETH for gas fees

Payment Process

  • • Automatic payment handling via web client
  • • Manual payment for API integration
  • • Cryptographic proof generation
  • • Transaction verification
Payment Tracking & Analytics

All payments are tracked and associated with:

Payment Information

  • • Payer wallet address
  • • Transaction hash
  • • Network used
  • • Timestamp and amount

Usage Analytics

  • • Message token usage
  • • Tool invocations
  • • Response quality metrics
  • • Cost per interaction
Troubleshooting

Common Issues

  • Payment fails: Check USDC balance and network connection
  • Network errors: Verify Base network is configured in wallet
  • High gas fees: Wait for lower network congestion
  • Transaction stuck: Check Base network status

Ready to Try X402 Payments?

Experience the future of micropayments for AI services

    We use cookies to enhance your experience, analyze site usage, and personalize content.

    AurraCloud - a Monemetrics Product