payagent + minia2a
Discovery meets payment. minia2a finds the x402 APIs. payagent pays them. Your agent code stays clean.
ARCHITECTURE
TypeScript / Python
Discover services
Pay HTTP 402
173+ on minia2a
The Problem
Your AI agent needs to call external APIs — gas oracles, token security checks, web scraping, Polymarket data. But those APIs cost money, and your agent can't fill out a credit card form or complete OAuth.
That's the gap the x402 protocol (HTTP 402 Payment Required) fills. And two tools make it practical:
- minia2a — 173+ x402-wrapped services, discoverable via API
- payagent — npm package that handles HTTP 402 payment automatically
1 Discover services on minia2a
minia2a lists 173+ x402 endpoints across categories like gas, token security, DeFi data, web tools, and more. Your agent can query the directory to find the services it needs.
# List all x402 services (JSON)
curl https://minia2a.uk/api/stats | python3 -c "
import sys, json
d = json.load(sys.stdin)
for ep, data in sorted(d.get('trials',{}).get('byEndpoint',{}).items(), key=lambda x: -x[1].get('used',0)):
if ep.startswith('x402-'):
print(f'{data[\"used\"]:>5} trials — {ep}')
" | head -15
Popular endpoints right now:
| Endpoint | What it does | Cost |
|---|---|---|
x402-gas | Live gas prices (ETH, Base, Arbitrum) | 1 credit |
x402-captcha-solve | Solve CAPTCHAs programmatically | 1 credit |
x402-web-scrape | Scrape any webpage, returns clean text | 1 credit |
x402-token-security | Check token for honeypots, taxes, ownership | 1 credit |
x402-polymarket | Real-time Polymarket odds and data | 1 credit |
x402-wallet-intel | Analyze any wallet's activity and risk | 1 credit |
2 Install payagent
payagent gives you a drop-in fetch replacement that handles HTTP 402 responses transparently. When an API returns "402 Payment Required", payagent pays it with USDC (via ArisPay's delegated custody) and retries.
npm install payagent
3 Wire them together
Here's the complete pattern: query minia2a to discover services, then call them through payagent's payment-aware fetch.
import { DelegationClient, payFetchDelegated } from 'payagent';
// ── Setup: provision an agent wallet via ArisPay ──
const client = new DelegationClient(
'https://api.arispay.app',
process.env.ARISPAY_KEY
);
const agent = await client.createX402Agent({
name: 'my-research-agent',
maxPerTx: 100, // $1.00 max per call
maxDaily: 1000, // $10/day cap
maxMonthly: 10000, // $100/month cap
allowedDomains: ['minia2a.uk'], // services proxied through minia2a
});
// Fund wallet with USDC on Base, then wait
console.log('Deposit USDC to:', agent.walletAddress);
await client.pollUntilFunded(agent.agentId);
// ── Create payment-aware fetch ──
const payFetch = payFetchDelegated({
arispayUrl: 'https://api.arispay.app',
apiKey: agent.apiKey,
});
// ── Discover a service on minia2a ──
const registry = await fetch('https://minia2a.uk/api/stats');
const { services } = await registry.json();
console.log(`${services} x402 services available on minia2a`);
// ── Call any x402 service — payment handled automatically ──
const gas = await payFetch(
'https://minia2a.uk/x402/gas',
{ headers: { 'Content-Type': 'application/json' } }
);
const { ethereum, base, arbitrum } = await gas.json();
console.log(`Gas now — ETH: ${ethereum}, Base: ${base}, Arb: ${arbitrum}`);
// ── Or call multiple services in parallel ──
const [tokenReport, gasData] = await Promise.all([
payFetch('https://minia2a.uk/x402/token-security', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ token: '0x...' }),
}).then(r => r.json()),
payFetch('https://minia2a.uk/x402/gas').then(r => r.json()),
]);
console.log('Token risk:', tokenReport.risk);
console.log('Base gas:', gasData.base);
4 No payagent? Use minia2a directly
Even without payagent, you can call minia2a services. Register to get 500 free credits (1 credit = $0.005, 1 USDC = 200 credits), then call any endpoint:
# 1. Register (one command — auto-creates a wallet)
curl -X POST https://minia2a.uk/api/v1/register-simple \
-H 'Content-Type: application/json' \
-d '{"name":"my-agent"}'
# Response: {"wallet":"0x...","privateKey":"0x...","credits":500}
# 2. Pay-per-call with your wallet
curl "https://minia2a.uk/x402/gas" \
-H "X-Wallet: 0xyourwallet"
minia2a vs. payagent — what each does
| minia2a | payagent | |
|---|---|---|
| Service discovery | ✅ 173+ endpoints, searchable | ❌ |
| HTTP 402 payment | ✅ Credits / wallet-based | ✅ Delegated custody via ArisPay |
| Key management | You hold the key | CDP holds the key |
| Spending limits | Credit balance = limit | Per-tx, daily, monthly caps |
| Setup time | 1 curl command | npm install + ArisPay key |
| Best for | Quick start, testing, indie agents | Production, teams, compliance |