Archived. Template moved to adk-ts-samples repo.
iqai-x402-agent is an early-stage TypeScript project in the AI payments / x402 ecosystem, focused on ai-agent, archived, payments, x402. It currently has 2 GitHub stars and 0 forks, and sits alongside related tools like botwallet, lightning-wallet-mcp, x402-payments-mcp, x402-payment, agent-cli, agent-commerce-demo.
⚠️ This repository has been archived.
The x402 Agent Template has been moved to our official ADK-TS Samples repo:
https://github.com/IQAIcom/adk-ts-samples/tree/main/apps/atp-micropayment-agent
Future updates, maintenance, and support will happen there.
A template showing how to build AI agents that access IQ AI's Agent Tokenization Platform (ATP) through paid API endpoints using the x402 micropayment protocol. The agent pays for API calls automatically using cryptocurrency, enabling new business models for AI-powered services.
Built with ADK-TS - Agent Development Kit (ADK) for TypeScript
This template demonstrates how to build monetized AI agents that:
🤖 Access IQ AI's ATP (Agent Tokenization Platform) through paid API endpoints:
💰 Implement micropayments using the x402 protocol for API access monetization
🔐 Automatic payment handling with Web3 wallet integration
🌐 Provides monetized API server that proxies premium endpoints
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ AI Agent │ │ x402 Server │ │ IQ AI ATP API │
│ (ADK-TS) │ │ │ │ │
│ • Wallet Client │───▶│ • Payment Gates │───▶│ • Premium Endpoints │
│ • Premium Tools │ │ • Proxy Routes │ │ • ATP Data │
│ • Auto Payment │ │ • Price Config │ │ • Agent Analytics │
└─────────────────┘ └──────────────────┘ └─────────────────────┘
# Clone this repository
git clone https://github.com/IQAIcom/iqai-x402-agent.git
cd iqai-x402-agent
# Install dependencies
pnpm install
You need a wallet private key with Base Sepolia ETH for micropayments:
Create a new wallet (recommended for testing):
Fund with Base Sepolia ETH:
Fund with testnet USDC:
Create environment files for both server and agent:
Server Configuration (.env in /server folder):
# Navigate to server directory and copy environment file
cd server
cp .env.example .env
Edit server/.env:
FACILITATOR_URL="https://x402.org/facilitator"
ADDRESS=your_wallet_address_here # Your wallet address (to receive payments)
NETWORK=base-sepolia
Agent Configuration (.env in /agent folder):
# Navigate to agent directory and copy environment file
cd ../agent
cp .env.example .env
Edit agent/.env:
ADK_DEBUG=false # Enable debug mode
WALLET_PRIVATE_KEY=your_wallet_private_key_here
GOOGLE_API_KEY=your_google_api_key_here
Start both the payment server and AI agent:
# Start both server and agent in development mode
pnpm dev
This will start:
http://localhost:3001 - handles x402 payments and proxies IQ AI ATP APIhttps://adk-web.iqai.com - provides web interface to interact with the agent# Check if your server is running and view available endpoints
curl http://localhost:3001/api/price-list
Expected response showing endpoint prices:
{
"prices": {
"/api/prices": { "price": "$0.01", "network": "base-sepolia" },
"/api/holdings": { "price": "$0.05", "network": "base-sepolia" },
"/api/agents/info": { "price": "$0.05", "network": "base-sepolia" },
"/api/agents/stats": { "price": "$0.05", "network": "base-sepolia" },
"/api/agents/top": { "price": "$0.10", "network": "base-sepolia" }
}
}
https://adk-web.iqai.comThe agent will:
To test just the server or agent individually:
# Test just the server
cd server && pnpm dev
# Test just the agent (in another terminal)
cd agent && pnpm dev
# Test agent without web interface
cd agent && npx @iqai/adk-cli run
http://localhost:3001https://x402.org/facilitator| Endpoint | Price | Description |
|---|---|---|
/api/price-list |
Free | Get endpoint pricing information |
/api/prices |
$0.01 | Get current token prices |
/api/holdings |
$0.05 | Get wallet holdings for IQ AI agents |
/api/agents/info |
$0.05 | Get agent metadata by contract address |
/api/agents/stats |
$0.05 | Get agent performance statistics |
/api/agents/top |
$0.10 | Get top agents by various metrics |
x402-agent/
├── agent/ # AI Agent (ADK-TS)
│ ├── src/
│ │ ├── agents/
│ │ │ └── x402/
│ │ │ ├── agent.ts # Main agent configuration
│ │ │ └── tools.ts # Payment-enabled API tools
│ │ └── env.ts # Environment configuration
│ ├── package.json
│ └── README.md
├── server/ # Payment Server (Hono + x402)
│ ├── src/
│ │ └── index.ts # Payment middleware & ATP proxy
│ ├── package.json
│ └── README.md
├── package.json # Root workspace configuration
└── README.md
agent/src/agents/x402/tools.ts:const getNewTool = createTool({
name: "GET_NEW_TOOL",
description: "Description of your new tool",
schema: z.object({
param: z.string().describe("Parameter description"),
}),
fn: async ({ param }) => {
const response = await apiClient.get(`/api/new-endpoint`, {
params: { param },
});
return response.data;
},
});
server/src/index.ts:// Add to PAID_ROUTES configuration
const PAID_ROUTES = {
// ... existing routes
"/api/new-endpoint": { price: "$0.05", network },
};
// Add route handler
app.get("/api/new-endpoint", async (c) => {
// Your endpoint logic here
});
Modify the PAID_ROUTES object in server/src/index.ts:
const PAID_ROUTES: Record<string, { price: string; network: Network }> = {
"/api/prices": { price: "$0.02", network }, // Changed from $0.01
// ... other routes
};
Update the network configuration in your server .env:
NETWORK=mainnet # or polygon, optimism, etc.
http://localhost:3001.env files are properly configured.env fileThis template is open source and contributions are welcome! Feel free to:
💰 Ready to monetize? This template gives you everything you need to start building profitable AI-powered applications with micropayments!
Open-source wallet infrastructure for AI agents. Earn, spend, and trade USDC on Solana with human oversight and FROST threshold signing.
MCP Server for Lightning Faucet - Give your AI agent a Bitcoin wallet
Give AI agents a wallet — x402 payment tools over Model Context Protocol.
Base skill for x402 payment protocol — teach any AI agent to pay for HTTP 402 APIs with ERC20/TRC20 tokens. Build your own paid-API skills on top of this.
Dedicated CLI for AI agents to earn, pay, and participate in the AI economy. Access x402 paid APIs, create invoices to receive funds, request funds from human owners, and send or receive payments in USDC — all with built-in owner approvals, spending guardrails, and FROST threshold signing on Solana.
Watch two AI agents discover, negotiate, and pay each other — a complete machine economy demo
Your AI trading terminal assistant for US stocks, commodities, forex, and crypto.
The agent-native LLM router for autonomous agents. 55+ models (8 free), <1ms local routing, USDC payments on Base & Solana via x402.
A local-first AI agent with persistent memory, emotional intelligence, and a peer-to-peer skills economy.
The living ecosystem where AI agents complete tasks through workflow loops, improve through iterative execution, are evaluated by mentor agents or humans in the loop, and turn completed work into reusable work experience and data to improve future agents.
The living ecosystem where AI agents complete tasks through workflow loops, improve through iterative execution, are evaluated by mentor agents or humans in the loop, and turn completed work into reusable work experience and data to improve future agents.
The trust layer for agent-to-agent commerce — natural-language mandates, ERC-7710 delegated permissions, x402 payments, escrow, and dispute resolution as one open, catch-all Agent Skill / Claude Code plugin.