serpgrab

Blog · November 19, 2026 · 5 min read

Pay per search with x402: Google results for AI agents, no account needed

Every search API starts the same way: sign up, confirm your email, copy a key, maybe add a card. That is fine for a person. It is a wall for an AI agent that has a task to finish and a few dollars to spend.

So we added a second way in. Alongside API keys, serpgrab now accepts x402 payments: a request without a key can pay for itself, $0.003 a search in USDC on Base, and get the same SerpApi-format JSON back. No account, no subscription, no key to store.

What x402 is

x402 puts payments into plain HTTP using status code 402, Payment Required, which has been reserved since the 1990s and finally has a use:

  1. You request a URL. The server answers 402 and says what it costs, in a PAYMENT-REQUIRED header.
  2. Your client signs a payment for exactly that amount and sends the same request again, with the payment in a PAYMENT-SIGNATURE header.
  3. The server checks the payment, does the work, settles the payment, and answers 200 with the result. A PAYMENT-RESPONSE header carries the transaction hash.

The payment is a signed USDC transfer on Base, the Ethereum layer-2 network built by Coinbase. Your wallet signs it; a facilitator (we use Coinbase’s) checks it and submits it on chain, and pays the gas. You need USDC on Base, and no ETH.

What it costs, and what you are charged for

That is the same per-search price as the Pro plan ($15 for 5,000 searches, then $0.003 each), with no monthly fee. x402 is for agents and scripts that can’t, or shouldn’t, hold an account.

See the price, without a wallet

Ask for a search with no key, and decode the PAYMENT-REQUIRED header (base64 JSON):

curl -s -o /dev/null -D - "https://api.serpgrab.com/search.json?engine=google&q=pizza" \
  | grep -i '^payment-required:' | cut -d' ' -f2 | tr -d '\r' | base64 -d | jq '.accepts[0]'
{
  "scheme": "exact",
  "network": "eip155:8453",
  "amount": "3000",
  "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  "payTo": "0xF6e600d91Cb685d39F55d9a10C52BF5e6381450e",
  "maxTimeoutSeconds": 300,
  "extra": { "name": "USD Coin", "version": "2" }
}

That reads: pay 3000 units of USDC (6 decimals, so $0.003) on Base mainnet (eip155:8453) to our address. The response body says the same in words, and points to the free key if you’d rather have one.

Pay for a search in JavaScript

The x402 packages wrap fetch, so the paying part is three lines. Install them:

npm install @x402/fetch @x402/evm viem

Then:

import { wrapFetchWithPayment, x402Client } from '@x402/fetch';
import { registerExactEvmScheme } from '@x402/evm/exact/client';
import { privateKeyToAccount } from 'viem/accounts';

const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.WALLET_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

// no key: the 402 is paid ($0.003 in USDC on Base) and the request retried
const res = await payFetch('https://api.serpgrab.com/search.json?engine=google&q=pizza');
const data = await res.json(); // the same SerpApi-format JSON
console.log(data.organic_results[0].title);

Every parameter works as it does with a key: location, gl, hl, start, engine=google_maps and the rest. See the migration guide for the parameters, and the API docs for the full response.

By default the client refuses to pay more than $1 for any single request, whatever a server asks. To lower that cap, or to pay only us, build the client from a config:

const client = x402Client.fromConfig({
  schemes: [],
  spendControls: { maxAmountPerPayment: '$0.01' },
  policies: [(version, reqs) => reqs.filter((r) => r.payTo.toLowerCase() === '0xf6e600d91cb685d39f55d9a10c52bf5e6381450e')],
});
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.WALLET_KEY) });

Any x402 client works, in any language: the protocol is plain HTTP headers.

Agents on MCP

Our hosted MCP server takes x402 too. Connect to https://api.serpgrab.com/mcp without a key, and each tool call pays as it goes: the first answer to a tool call is the price, the x402 client pays and calls again, and the results come back with the transaction attached. google_search costs $0.003 per page read, and google_maps_search $0.003 per page.

With the @x402/mcp client:

npm install @x402/mcp @x402/evm @modelcontextprotocol/sdk viem
import { createx402MCPClient } from '@x402/mcp';
import { ExactEvmScheme } from '@x402/evm/exact/client';
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
import { privateKeyToAccount } from 'viem/accounts';

const client = createx402MCPClient({
  name: 'my-agent',
  version: '1.0.0',
  schemes: [{ network: 'eip155:8453', client: new ExactEvmScheme(privateKeyToAccount(process.env.WALLET_KEY)) }],
  spendControls: { maxAmountPerPayment: '$0.05' },
  autoPayment: true,
});
await client.connect(new StreamableHTTPClientTransport(new URL('https://api.serpgrab.com/mcp')));

const result = await client.callTool('google_search', { query: 'best pizza in austin' });
console.log(result.content[0].text);

Setup for Claude, Cursor and other clients with a key is on the MCP page.

The wallet

The agent needs a wallet holding USDC on Base. A few practical points:

Questions

How does it compare with a key? The same $0.003 a search as the Pro plan, without the $15 monthly fee, the signup or anything to cancel. If you search a few hundred times a month or less, the free key (250 searches) is cheaper still.

What if a search fails after I paid? You didn’t pay. The payment is checked before the search and settled only after it succeeds. A failed search cancels it, and the signed transfer is never submitted.

Can I see my payments? Each one is a USDC transfer on Base, visible on basescan.org under your wallet’s address. The transaction hash also comes back with each result.

Something broken, or another network or token you’d like? Email hello@serpgrab.com.

Get 250 free searches