Dev.to WebDev ๐Ÿ›  Dev ๐Ÿ‘ 0 ๐Ÿ“– 1 min read

How to give your AI agent web search with x402 (no API key)

Every x402serps endpoint is a normal JSON POST. Send it without payment and you get HTTP 402 back with payment requirements (price, network, payTo). An x402 client signs a USDC payment, puts it in the X-PAYMENT header an

Every x402serps endpoint is a normal JSON POST. Send it without payment and you get HTTP 402 back with payment requirements (price, network, payTo). An x402 client signs a USDC payment, puts it in the X-PAYMENT header and retries. There are no API keys.

1. Look at the 402

curl -i -X POST https://x402serps.com/api/v1/search \
  -H "content-type: application/json" -d '{"q":"x402 protocol","num":5}'

The payment-required header lists both Base (eip155:8453) and Solana USDC options, each for 4000 units ($0.004).

2. Try it free

curl -X POST https://x402serps.com/api/v1/search -H "content-type: application/json" \
  -H "X-Trial: 1" -d '{"q":"x402"}'

You get 25 trial calls, rate-limited to 10 a minute.

3. Pay with x402 from Node

import { wrapFetchWithPayment } from "x402-fetch";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.AGENT_KEY); // a low-balance agent wallet
const pay = wrapFetchWithPayment(fetch, account);

const r = await pay("https://x402serps.com/api/v1/search", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({ q: "best MCP servers 2026", num: 10, freshness: "week" }),
});
const { results } = await r.json();
console.log(results.map(x => `${x.position}. ${x.title} ${x.url}`).join("\n"));

Use a dedicated wallet with a small balance and a spending cap.

4. Or use it over MCP

Add the remote server https://x402serps.com/api/mcp (streamable HTTP; MCP Registry name com.x402serps/search). Tools include web_search, news_search, extract, places_search and deep_research.

5. No wallet?

Buy prepaid credits by card at /pricing and send Authorization: Bearer xs_....

Pricing (as of 3 Nov 2026)

Search is $0.004 per 10 results and extract is $0.003 per URL. For comparison, Exa lists search from $4 per 1k requests, and Tavily lists pay-as-you-go at $0.008 per credit, with basic search costing 1 credit. Check their pages for current rates.

Docs: https://x402serps.com/docs?utm_source=devto&utm_campaign=launch

๐Ÿ“ฐ Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes โ€” full credit and traffic to the original publisher.