Wrapped x402 Logo

Wrapped x402

An open-source library for AI-native x402 integrations in the Solana ecosystem.
Built for Python and Node.js, distributed via PyPI and npm, with server implementations for FastAPI and Express.js.
Accelerate.

Available Packages

wrappedx402-core Core implementation of x402 protocol for AI-native payments.
wrappedx402-client HTTP client SDK with built-in metering and payment verification.
wrappedx402-fastapi FastAPI middleware for instant x402 integration.
wrappedx402-express Express.js middleware to enable Node.js pay-per-use endpoints.
wrappedx402-langchain LangChain integration for AI agent payments with x402 protocol.
Wrapped x402 — About / Architecture

About Wrapped x402

Wrapped x402 is an open-source library that enables developers to integrate AI-native micro-payments and metering through the x402 protocol directly into Solana applications. It standardizes how AI agents, APIs, and decentralized servers interact using pay-per-use credits verified on-chain.

SDK Clients Python / Node.js packages (PyPI & npm) for unified x402 APIs.
Server Adapters FastAPI & Express implementations to verify x402 receipts.
Solana Network On-chain settlement & signature verification for AI transactions.
AI Apps / Agents Consume x402 credits to unlock LLM APIs and autonomous tasks.
Wrapped x402 — Core Modules

Core Modules

Wrapped x402 is built around four primary modules that make AI-native payments effortless — each designed to handle a specific layer of the x402 flow from SDK clients to verifiers and tooling.

SDKs

Lightweight libraries for Python and Node.js providing unified methods to create, sign, and verify x402 receipts. Published on PyPI and npm for fast integration into AI workflows.

Servers

Reference implementations for FastAPI and Express to handle incoming x402 requests, validate payments, and unlock API routes based on usage credits and signatures.

Verifiers

Stateless verifiers that check transaction hashes, expiration (TTL), and anti-replay proofs to ensure trusted AI billing on Solana without centralized gateways.

Tools

Developer CLI and utility modules for debugging, monitoring, and managing x402 credits across multi-agent AI systems and serverless runtimes.

Wrapped x402 — Developer Philosophy

Developer Philosophy / Design Principles

Wrapped x402 is built on a clear philosophy — make AI-native micropayments open, modular, and lightning-fast. These design principles ensure every line of code empowers developers, not complicates them.

1. Simple API Surface

Minimal methods, clear naming, predictable outputs. Developers should integrate x402 in minutes, not hours.

2. Open Verification

All verification logic is open-source and reproducible — no hidden middle layers, no centralized gateway.

3. Lightweight Runtime

No heavy dependencies or custom compilers. Runs cleanly on serverless, containers, or embedded AI nodes.

4. AI-Native Mindset

Every module is built with LLMs, inference endpoints, and agent systems in mind — from credit metering to trustless pay-per-use.

Wrapped x402 — How It Works

How It Works

The Wrapped x402 flow enables AI Agents to pay for premium endpoints securely and automatically. Each transaction passes through six verifiable steps between the Agent, Server, and Blockchain.

1
GET /data AI Agent requests premium content.
→ API Server
2
402 Payment Required Server returns a payment request via x402 protocol.
← AI Agent
3
Broadcast Payment Agent sends payment transaction to the Solana blockchain.
→ Blockchain
4
Verify Transaction Server verifies on-chain payment in ~200ms using x402 verifier.
← API Server
5
GET /data + Auth Agent retries request with payment proof attached.
→ API Server
6
200 OK + Data Server returns unlocked premium content to the Agent.
← AI Agent
Wrapped x402 — Security & Verification

Security & Verification

Wrapped x402 implements a multi-layer verification model to ensure every transaction is trustless and verifiable — preventing replay attacks, enforcing expiration windows, and maintaining transparent on-chain auditability.

TTL Expiry

TTL Expiry Control

Each x402 receipt has a short-lived time-to-live (TTL) window, ensuring that payments cannot be reused after their expiration period.

Anti Replay

Anti-Replay Protection

Every proof includes a nonce and unique signature, blocking duplicated or forged payment attempts across sessions.

Credit Proof Flow

Credit Proof Flow

Credits are signed cryptographically by the server, allowing AI Agents to re-authenticate without storing private keys.

On-Chain Validation

On-Chain Validation

All transactions are verified directly on Solana within ~200 ms, ensuring that each payment is recorded and auditable.