x402

x402 is a payment protocol that unlocks HTTP 402 Payment Required, turning it into a working payment system for AI agents and applications. The protocol enables programmatic, autonomous payments without requiring accounts, credit cards, or manual human intervention. Built on EIP-3009 (transferWithAuthorization), x402 allows AI agents to discover services, understand pricing, sign payment authorizations, and pay for API access—all automatically through HTTP requests and responses.

The protocol is designed for machine-to-machine payments, making it ideal for AI agents that need to pay for API access, data services, or computational resources. With x402, payments are as simple as an HTTP request: when an agent requests a paid resource, the server responds with HTTP 402 and payment instructions. The agent then signs a payment payload, retries the request with an X-PAYMENT header, and receives the resource—all without human intervention.

General
Release date2024
AuthorCoinbase
Documentationx402 Documentation
RepositoryGitHub
TypePayment Protocol

Start building with x402

x402 makes payments HTTP-native, enabling AI agents to autonomously discover and pay for services. The protocol supports gasless payments through facilitators, works with any EIP-3009 token (USDC by default), and provides SDKs for popular frameworks like Express and Axios. Whether you're building a paid API service or an AI agent that needs to purchase resources, x402 simplifies the payment flow into standard HTTP requests and responses. Check out the community-built x402 use cases and applications to see what others are building.

x402 Tutorials


x402 Resources

Essential resources to help you get started with x402:


x402 Libraries and SDKs

Official and community libraries for integrating x402 into your applications:

  • @x402/core - Core x402 protocol types and utilities
  • @x402/express - Express middleware for x402 payments
  • @x402/axios - Axios interceptor for automatic payment handling
  • @x402/evm - EVM-specific payment schemes (EIP-3009 support)

x402 Integrations

Connect x402 with your favorite frameworks and tools:

  • Express.js: Use @x402/express middleware to protect API endpoints with payment requirements
  • Axios: Use @x402/axios to automatically handle 402 responses and payment flows in client applications
  • React: Build React applications that automatically pay for API access using x402
  • Node.js: Integrate x402 into any Node.js application for server-side payment processing

x402 Features

Key features that make x402 powerful for AI-to-AI payments:

  • HTTP-Native: Payments work through standard HTTP requests and responses
  • Gasless Payments: Facilitators sponsor gas fees, making payments seamless
  • No Accounts Required: Payments work with crypto wallets, no account creation needed
  • Autonomous: AI agents can discover, understand pricing, and pay without human intervention
  • Universal Compatibility: Works with any EIP-3009 token (USDC by default)
  • Framework Support: SDKs available for Express, Axios, and more

x402 top builders

Explore the top contributors showcasing the highest number of x402 app submissions within our community.

Coinbase x402 AI technology Hackathon projects

Discover innovative solutions crafted with x402, developed by our community members during our engaging hackathons.

interpres: talk to any MCP server

interpres: talk to any MCP server

AssemblyAI prices its Voice Agent API at $4.50 an hour and lists OpenAI Realtime at $18. Realtime can call MCP servers by itself. The Voice Agent API takes function and http tools only, so a team that switches for the price loses every MCP server its agent used to call. interpres gives them back. Type a website or paste an MCP URL. interpres looks in the official MCP registry, finds the server and turns each of its tools into a Voice Agent function tool. No website in mind? Search more than 11,000 public servers on the page and connect with one click. The agent sees ten tools at a time, since 45.6% of public servers list more, and a search step swaps the right ones in mid-conversation with new keyterms and a new transcription prompt. I ran the converter over the whole official registry. 12,012 servers answered without a login, listing 202,191 tools, and every tool converted. Then I gave 30 of them one spoken question each, untuned. 29 sessions ran, 14 answered from live data, and when a tool ran the median was 3.5 seconds voice to voice. A later A/B moved every session to the fastest transcription mode: 0.6 seconds quicker at the median, with nothing heard worse. Speech is bad at identifiers. Before I added a gate, a misheard wallet address reached the server 5 times, and a right hearing looks exactly like a wrong one. Now an address only runs if it comes from the paste box or an earlier tool result, tools that change state wait for a yes, and a paid tool says its x402 price instead of failing. The LLM Gateway writes starter questions for each server. The demo video was recorded live, and every voice figure comes with session IDs from Session History. Two places where the API behaves differently from its docs are written up with scripts that reproduce them. MIT licensed and live now.

Fresno LUX: A Living City

Fresno LUX: A Living City

Fresno LUX is a prototype for a living intelligence layer across an entire city. Fresno already contains enormous amounts of intelligence: residents know where problems exist, nonprofits know where help is needed, businesses know where opportunities exist, educators understand gaps in learning, researchers generate knowledge, and government maintains critical infrastructure and data. The problem is that much of this intelligence is fragmented across disconnected systems. Fresno LUX connects those pieces. The platform creates a shared city graph where people, organizations, resources, needs, projects, observations, experiments, and outcomes become connected nodes. Instead of simply collecting data, LUX continuously asks: What is happening? What do we know? What is missing? What can we test? What changed? A community problem can become an observable signal. That signal can become an experiment. The experiment produces evidence. Evidence changes the system's understanding. That updated understanding informs the next action. Observe → Connect → Understand → Act → Measure → Learn → Converge. The goal is to move Fresno from disconnected information toward collective intelligence—a system where knowledge can travel across boundaries and successful solutions can be discovered, tested, measured, and replicated. LUX is designed to make the invisible connections visible: the relationship between a neighborhood and its resources, between a student and educational opportunity, between a business and workforce capacity, between environmental conditions and community health, and between an idea and measurable real-world impact. This hackathon prototype demonstrates the beginning of a Living Fresno Graph: a city that can observe itself, learn from evidence, and coordinate toward better outcomes.

MemoryMint — Pay-per-Query AI Second Brain

MemoryMint — Pay-per-Query AI Second Brain

MemoryMint is a decentralised, pay-per-query AI second brain built for AMD Developer Hackathon ACT II. PROBLEM Knowledge workers generate dozens of documents weekly but can never search across them. Existing tools require subscriptions, centralised APIs, and don't support AI agent access natively. SOLUTION Upload any PDF or TXT file → MemoryMint chunks and embeds it using BAAI/bge-small-en-v1.5 on AMD Instinct MI300X with ROCm 7.2.4 → query in natural language → get cited answers. Every query is gated by X402 micropayments — $0.001 USDC on Base Sepolia, verified on-chain via x402.org/facilitator. KEY FEATURES - Own brain: upload files, chat with your knowledge, pay $0.001 per answer - Public brain sharing: publish your brain at /brain/{id}, earn USDC every time someone queries it - Agent-to-agent payments: AI agents discover price via /payment-info, pay autonomously via EIP-3009 and CDP SDK — zero human interaction - Earnings dashboard: real-time USDC earned, per-source breakdown, transaction feed with Basescan links - Python SDK: pip install memorymint → 5 lines to query any public brain AMD INTEGRATION - BAAI/bge-small-en-v1.5 runs on AMD Instinct MI300X via ROCm 7.2.4 - 6.5x embedding throughput vs CPU — 2914.1 chunks/sec on MI300X vs 448.2 chunks/sec on CPU (see benchmark.py) - GPU auto-detected at startup — falls back to CPU gracefully for local dev X402 INTEGRATION - HTTP 402 middleware gates /query and /brain/{id}/query endpoints - Browser wallets (MetaMask, Coinbase Wallet) pay via ERC-20 USDC transfer - AI agents pay via EIP-3009 off-chain signatures using Coinbase CDP SDK - x402.org/facilitator verifies all payments before requests are processed TECH STACK FastAPI · Qdrant · BAAI/bge-small-en-v1.5 · Groq llama-3.3-70b · Next.js App Router · wagmi v3 · viem · X402 · Base Sepolia · AMD Instinct MI300X · ROCm 7.2.4