For Developers
Build AI agents that automatically handle x402 payments. The only fully automated solution that handles token swapping, payment processing, and request retries—all without manual intervention.
🚀 x402 Auto-Pay Agent
The only fully automated x402 payment handler. Your agents can pay for APIs automatically, swap tokens when needed, and retry requests—all without manual intervention. Zero integration complexity.
How It Works
- Agent calls API → Gets 402 Payment Required
- Auto-pay agent intercepts → Parses payment requirements
- Checks balance → Swaps tokens if needed (automatically)
- Makes payment → Confirms transaction
- Retries original request → Success!
Quick Start
import { HTTPInterceptor } from '@moltydex/agent';
// Setup once
const interceptor = new HTTPInterceptor({
apiUrl: 'https://api.moltydex.com',
walletSecretKey: process.env.WALLET_SECRET_KEY,
autoSwap: true,
});
// Now all fetch() calls handle 402 automatically!
const response = await fetch('https://premium-api.com/data');
const data = await response.json(); // Works seamlessly!Features
✅ Fully Automated
No manual intervention needed. Agents handle payments completely automatically.
🔄 Token Swapping
Automatically swaps any token → required token. Works with SOL, USDC, USDT, and more.
🔐 Secure
Client-side signing. Private keys never leave your system.
⚡ Event-Driven
Uses webhooks instead of polling. Efficient and scalable.
Use Cases
1. Premium API Access
Your agent needs premium data or services that require payment. MoltyDEX automatically handles the entire payment flow—no manual steps required.
// Just call APIs normally - agent handles 402 automatically!
// If payment needed: swaps tokens → pays → retries → success
const response = await fetch('https://premium-api.com/data');
const data = await response.json();2. Multi-API Data Collection
Collect data from multiple paid APIs simultaneously. MoltyDEX handles all payments, token swaps, and retries automatically—even if each API requires different tokens.
// Parallel API calls with automatic payment handling const apis = ['api1.com', 'api2.com', 'api3.com']; const results = await Promise.all( apis.map(url => fetch(url).then(r => r.json())) );
3. Agent-to-Agent Payments
Enable your agents to pay other agents for specialized services. Perfect for multi-agent workflows where agents need to purchase capabilities on-demand.
4. Dynamic Token Management
Agents automatically swap any token to the required payment token. No need to pre-fund specific tokens—agents can pay with whatever they have.
API Reference
MoltyDEX provides a simple REST API for programmatic access.
Key Endpoints
GET /api/quote- Get swap quotePOST /api/swap/build- Build swap transactionGET /api/balance- Check token balancePOST /api/x402/parse-payment- Parse 402 responsePOST /api/x402/auto-pay- Complete payment flow
Ready to Get Started?
Build agents that handle payments automatically. Get started in minutes.