Generic x402 client (Node / Python) setup

MCP endpoint: https://freetier-agent-api.pages.dev/mcp (Streamable HTTP) · other recipes: Claude Desktop · Claude Code · Cursor

Any x402 client can call the HTTP routes directly with a Base wallet that holds a little USDC (no ETH needed for gas; the facilitator settles). Use a dedicated low-balance wallet for agents.

Node (@x402/fetch)

// npm i @x402/fetch @x402/evm viem
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.EVM_PRIVATE_KEY);
const fetchWithPayment = wrapFetchWithPaymentFromConfig(fetch, {
  schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(account) }],
});
const res = await fetchWithPayment("https://freetier-agent-api.pages.dev/api/dns?domain=github.com");
console.log(await res.json());

Python (x402 + httpx)

# pip install "x402[httpx,evm]" eth-account
import asyncio, os
from eth_account import Account
from x402 import x402Client
from x402.http.clients import x402HttpxClient
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact.register import register_exact_evm_client

async def main():
    client = x402Client()
    register_exact_evm_client(client, EthAccountSigner(Account.from_key(os.environ["EVM_PRIVATE_KEY"])))
    async with x402HttpxClient(client) as http:
        r = await http.get("https://freetier-agent-api.pages.dev/api/dns?domain=github.com")
        print(r.json())

asyncio.run(main())

Over MCP

MCP clients that implement the x402 MCP transport can connect to https://freetier-agent-api.pages.dev/mcp: an unpaid tools/call returns isError with the x402 PaymentRequired object in structuredContent; sign it and repeat the call with params._meta["x402/payment"]. The receipt comes back in result._meta["x402/payment-response"].

No wallet?

curl -s "https://freetier-agent-api.pages.dev/api/dns?domain=github.com" -H "X-License-Key: YOUR-LICENSE-KEY"

How paying works

3 prompts to try

  1. Check the DNS, SPF and DMARC records for github.com and tell me whether its mail setup has any warnings.
  2. Geocode "Rådhuspladsen 1, København" and then reverse-geocode the coordinates you get back.
  3. Look up the ERC-20 token 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 on Base: name, decimals and USD price.

Tools used: dns, domain_whois, ssl_cert, geocode, token_info, invoice_json. Prices: price list.


Agent Extraction API by FreeTier Kits · Terms · llms.txt · /.well-known/x402 · MCP: https://freetier-agent-api.pages.dev/mcp · Contact: tec@mail.grokbot.com
This site and its texts were written with AI assistance and reviewed for accuracy; example outputs are real responses from the API.