Build an AI Agent That Pays for Its Own APIs

A practical guide using minia2a.uk — 150+ x402-payable services on Base L2. No API keys, no KYC, no human signup. Just USDC micropayments.

Target audience: AI agents and developers building autonomous agent systems. This guide assumes basic familiarity with HTTP and JSON.

Step 1: Register Your Agent (One Command)

Get 500 free credits — no wallet needed

curl -X POST https://minia2a.uk/api/v1/register-simple \
  -H "content-type: application/json" \
  -d '{"name":"my-agent"}'

Response includes your auto-generated wallet address, private key, and 500 credits. Save the private key.

Step 2: Call a Service (Credits Auto-Deduct)

Append your wallet to any endpoint

curl "https://minia2a.uk/x402/gas?wallet=0xYOUR_WALLET"

1 credit = $0.005. Variable pricing: cheap services cost 1 credit, premium services cost more. Free services cost 0.

Step 3: Discover Available Services

Browse the catalog

curl https://minia2a.uk/api/services       # Full JSON catalog
curl https://minia2a.uk/x402/preview       # Human-friendly preview
curl https://minia2a.uk/mcp                # MCP tools list

150+ services: gas oracles, captcha solving, web scraping, token security, DEX prices, DNS lookup, email verification, and more.

Step 4: When Credits Run Low

Buy more credits with USDC on Base

# 1. Send USDC on Base to:
#    0xf16F0882de08315B438E9f3a2Abfb2d2E5d94ECA
#    (include your wallet address in memo)

# 2. Verify the transaction:
curl -X POST https://minia2a.uk/api/v1/buy-credits \
  -H "content-type: application/json" \
  -d '{"wallet":"0x...","txHash":"0x..."}'

# Rate: 1 USDC = 200 credits

Step 5: Integrate With Your Agent Code

JavaScript/Node.js (npm)

npm install minia2a-client
const minia2a = require('minia2a-client');

async function myAgentTask() {
  const wallet = await minia2a.getOrCreateWallet();
  const gas = await minia2a.call('gas');
  const token = await minia2a.call('token-security', { address: '0x...' });
  const page = await minia2a.call('web-scrape', { url: 'https://example.com' });
  return { gas, token, page };
}

ElizaOS

import { call, getOrCreateWallet } from 'minia2a-client';

export const minia2aAction = {
  name: 'MINIA2A_GAS',
  handler: async () => { await getOrCreateWallet(); return call('gas'); }
};

LangChain

import { DynamicTool } from 'langchain/tools';
import { call, getOrCreateWallet } from 'minia2a-client';

await getOrCreateWallet();
const tool = new DynamicTool({
  name: 'minia2a_gas',
  func: async () => JSON.stringify(await call('gas'))
});

How x402 Payments Work

When you call an endpoint without a wallet, the server returns HTTP 402 with payment details. When you call WITH a wallet, credits are deducted from your balance. No blockchain transaction per call — credits are off-chain for speed. Top up with USDC when needed.

Production stats: 153 services, 32 registered agents, 280K+ requests processed, $0.001-$1.00 per call. Live stats →

Home · AGENTS.md · x402 Help · Register