

Payroute
Gen AI & API Marketplace with x402 Payments.
Service wrapper enabling pay-per-hit API access using x402 payments. Creators sell API proxies, users pay with stablecoin.
Wrap existing APIs & Gen AI with payment layer. Each request requires x402 payment authorization before proxying to target endpoint.
Monetize APIs & Gen AI instantly. Set pricing per request, receive stablecoin payments automatically through smart contracts.
Pay-as-you-go model eliminates subscription fees. Access premium APIs & Gen AI with micro-payments using digital wallet integration.

AI API PROXY
Service wrapper that allows clients to access premium AI APIs like ChatGPT, Claude, and Gemini with pay-per-request using x402 protocol.
Perfect for AI applications requiring flexible usage pricing.
X402 PAYMENTS
Pay-per-hit authentication system using stablecoin transactions directly to API creators.
MARKETPLACE
Creators can sell Gen AI & API proxies on Payroute while users purchase access using x402 payment system.

Payroute Portal

Service wrapper enabling API endpoint proxy with x402 authentication.
PROXY
Wrap APIs with x402 payment layer for monetization.
MARKETPLACE
List Gen AI & API proxies for automatic discovery and purchase.
PAYMENTS
Instant settlement through x402 protocol.

@payroute/x402-sdk
TypeScript SDK for integrating x402 payment protocol into your applications. Enable pay-per-hit API access and AI agent interactions with automatic payment handling.
View on npmQuick Installation
npm install @payroute/x402-sdk1. Initialize the Service
Set up the payment service with your wallet credentials
import { PaymentService } from "@payroute/x402-sdk";
const service = new PaymentService({
privateKey: process.env.WALLET_PRIVATE_KEY,
network: "mantle",
});2. Consume Paid API Endpoint
Access premium content with automatic payment handling
try {
const content = await service.getProxyEndpoint("MantleDocs");
console.log("Accessed Content:", content);
} catch (error) {
console.error("Payment Failed:", error);
}3. Interact with AI Agent
Send messages to AI agents with per-message payments
try {
const response = await service.generateAIResponse(
"mantleAgent",
"How to build smart contract on Mantle?"
);
console.log("AI Response:", response);
} catch (error) {
console.error("Agent Interaction Failed:", error);
}Advanced Usage
Custom RPC Provider
Override default RPC URLs for custom configuration
const service = new PaymentService({
privateKey: "...",
rpcUrl: "https://rpc.ankr.com/mantle",
});Autonomous Research Agent
AI agent that automatically pays for premium data using its own wallet
import { PaymentService } from "@payroute/x402-sdk";
import { openai } from "./my-llm-setup";
const agentWalletKey = process.env.AGENT_PRIVATE_KEY;
const payroute = new PaymentService({
privateKey: agentWalletKey,
network: "mantle",
});
async function autonomousResearchTask(topic: string) {
console.log(`Agent starting research on: ${topic}...`);
const premiumData = await payroute.getProxyEndpointEscrow("HighValueData");
console.log("Data acquired. Analyzing...");
const analysis = await openai.chat.completions.create({
model: "gpt-4",
messages: [{
role: "user",
content: `Analyze this data: ${JSON.stringify(premiumData)}`,
}],
});
return analysis.choices[0].message.content;
}Agent-to-Agent Consultation
Enable AI agents to pay and consult specialized expert agents
async function consultExpertAgent(problem: string) {
const expertAgentSlug = "legal-expert-v1";
console.log(`Consulting ${expertAgentSlug}...`);
const expertAdvice = await payroute.generateAIResponseEscrow(
expertAgentSlug,
`I have a user asking about: ${problem}. What are the compliance risks?`
);
return expertAdvice.response;
}Why Autonomous Economic Agents?
This pattern transforms passive tools into economically active agents capable of trading value for information or services on the open market. LLMs can autonomously access premium data, consult expert agents, and manage resources without user intervention.

Bring x402 to
for all payments
Build, scale, and monetize APIs with pay-per-hit transactions using x402 protocol on Mantle Network.
Launch App