Build an AI Agent That Pays for Its Own APIs

A practical guide using minia2a.uk1,673 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 5 free trial calls — bring your own wallet

# 1. Sign "minia2a register: 0xYOUR_WALLET" with your wallet (EIP-191 personal_sign).
# 2. POST your name + wallet + signature:
curl -X POST https://minia2a.uk/api/v1/register-simple \
  -H "content-type: application/json" \
  -d '{"name":"my-agent","wallet":"0xYOUR_WALLET","signature":"0xYOUR_SIGNATURE"}'

You bring your own wallet — the platform never holds your private key. Response binds 5 free trial calls to your wallet.

Step 2: Call a Service (Signed Trial Call)

Append your wallet to any endpoint

# BOTH halves are required: the ?wallet= query param AND a signature over
#   minia2a trial:<wallet>:<serviceId>:<unixSeconds>   (EIP-191 personal_sign)
# serviceId for this endpoint is x402-gas.
export WALLET=0xYOUR_WALLET
export TS=$(date +%s)
export SIG=0xYOUR_SIGNATURE

curl "https://minia2a.uk/x402/gas?wallet=$WALLET" \
  -H "X-Wallet-Signature: $SIG" -H "X-Trial-Timestamp: $TS"
Heads up — ?wallet= on its own is not enough. The query param and the signature are two halves of one request. Send the wallet without a signature and the gateway answers 400 missing X-Wallet-Signature header — it does not fall back to anything. Both headers are required:
MSG="minia2a trial:$WALLET:x402-time:$TS"   # sign with EIP-191 (personal_sign)
curl "https://minia2a.uk/x402/time?wallet=$WALLET" \
  -H "X-Wallet-Signature: $SIG" -H "X-Trial-Timestamp: $TS"
# -> 200, x-trial-mode: wallet, x-trial-max: 5, x-trial-remaining: 4
The x402-time in that message is the service id from /api/servicesnot the URL path segment (time). Sign the wrong one and the gateway tells you the string it wanted: 400 signature does not match wallet — sign message: minia2a trial:<wallet>:x402-time:<ts>. $TS is unix seconds, accepted within ±5 minutes. Full recipe in AGENTS.md.

Pricing is per call and set by each service — there is no platform-wide credit to buy, hold, or top up. The exact amount for a call is in the 402 response's accepts[].amount field (USDC, 6 decimals). After your 5 free trial calls, every call is paid individually via x402.

Step 3: Discover Available Services

Browse the catalog

curl https://minia2a.uk/api/services       # Full JSON catalog
curl https://minia2a.uk/api/services?q=gas  # Free catalog search (JSON)
curl https://minia2a.uk/mcp                # MCP tools list

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

Step 4: When Your Trials Run Out

Pay per call with USDC on Base

There is no balance to top up — the deposit rail was retired on 2026-09-06. After your 5 free trial calls, each call is paid on its own over x402: the service answers 402 with the price and its payTo address, your agent sends USDC on Base, and the call is retried with the payment proof.

curl "https://minia2a.uk/x402/time?probe=1"   # 402 + accepts[]: amount + payTo

Full flow: payment docs.

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, a valid signature draws on your 5 free trial calls. After that, each call is paid individually over x402 — no balance is held for you and there is no top-up rail.

Production stats: 1,673 services, 102 registered agents, 2298K+ requests processed, $0.001-$1.00 per call. Live stats →

Home · AGENTS.md · x402 Help · Register