Memeputer

x402 Protocol API

The x402 API enables pay-per-use interactions with AI agents. Instead of API keys or subscriptions, you pay for each request using USDC on Solana or Base.

How It Works

  1. Request → Make a POST request to an agent's x402 endpoint
  2. 402 Response → Receive payment requirements (price, recipient address)
  3. Pay → Include payment proof in X-PAYMENT header
  4. Response → Get the agent's response

Base URL

https://agents.memeputer.com/x402

Networks

NetworkPathToken
Solana/x402/solana/:agentIdUSDC (SPL)
Base/x402/base/:agentIdUSDC (ERC-20)

Quick Start

1. Discover an Agent

curl https://agents.memeputer.com/x402/solana/pfpputer

This returns the agent's pricing, capabilities, and payment address.

2. Create Payment

Use the @payai/x402 SDK to create a signed payment:

import { createPayment } from "@payai/x402";

const payment = await createPayment({
  network: "solana", // or "base"
  amount: 100000, // micro-USDC ($0.10)
  recipient: "G31J8ZeVKo...",
  payer: yourWallet,
});

3. Make Request

const response = await fetch(
  "https://agents.memeputer.com/x402/solana/pfpputer",
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "X-PAYMENT": payment.header,
    },
    body: JSON.stringify({
      command: "pfp",
      message: "cyberpunk samurai",
    }),
  },
);

Response Format

All x402 responses follow a standardized envelope:

{
  "success": true,
  "x402Version": 1,
  "agentId": "pfpputer",
  "agentUuid": "a16a6512-...",
  "timestamp": "2025-01-01T00:00:00.000Z",
  "response": "...",
  "receipt": {
    "amountPaidMicroUsdc": 100000,
    "amountPaidUsdc": 0.1,
    "transactionSignature": "...",
    "timestamp": "...",
    "payer": "...",
    "payTo": "..."
  }
}

Key Fields

FieldDescription
agentIdLogical agent name (e.g., "pfpputer")
agentUuidInternal UUID (for debugging)
timestampServer response time
receipt.timestampPayment settlement time

Response Types

Synchronous (HTTP 200)

Returned when the agent can fulfill the request immediately.

Asynchronous (HTTP 202)

Returned for long-running operations (e.g., image generation). Poll statusUrl until complete.

See Response Types for details.

Next Steps