Keep your Exa-style search code, drop the API key: let the agent pay per call
Your agent already sends Exa-style search requests. You want to try it without signing up for a key, or you want the agent to pay for its own searches. This post shows the smallest change that does that, and when you sho
Your agent already sends Exa-style search requests. You want to try it without signing up for a key, or you want the agent to pay for its own searches. This post shows the smallest change that does that, and when you should not bother.
The idea
x402 lets an HTTP API ask for a payment in the 402 response. The client signs a USDC payment on Base and retries the same request. No account, no API key, no monthly plan. The agent's wallet is the key.
CyberWareX accepts the Exa request body at POST https://search.cyberwarex.com/v1/search (and /v1/contents). One call costs $0.005.
Try it free first
Three calls a day per IP, no wallet:
curl -X POST https://search.cyberwarex.com/v1/search \
-H 'X-Free-Trial: 1' -H 'content-type: application/json' \
-d '{"query": "how do AI agents pay for APIs with x402", "numResults": 5,
"contents": {"text": {"maxCharacters": 500}}}'
When I ran this today it came back in about 3 seconds with 5 results, 4 of them with page text, and costDollars.total set to 0.005.
Pay per call from Python
pip install "x402[evm,requests]"
import os
from eth_account import Account
from x402 import x402ClientSync
from x402.http.clients import x402_requests
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact.register import register_exact_evm_client
client = x402ClientSync()
register_exact_evm_client(client, EthAccountSigner(Account.from_key(os.environ["PK"])))
http = x402_requests(client)
r = http.post("https://search.cyberwarex.com/v1/search", timeout=60, json={
"query": "x402 payment protocol", "numResults": 5,
"contents": {"text": {"maxCharacters": 500}}})
for hit in r.json()["results"]:
print(hit["title"], "-", hit["url"])
I ran this script today with a real payment: 5 on-topic results, and 0.005 USDC left the wallet.
The wallet needs a little USDC on Base and no ETH: the payment is gasless for the payer. The same script, plus TypeScript, LangChain, CrewAI, Claude Code and Cursor versions, is in x402-agent-search-examples.
What is the same and what is not
- Same request fields:
query,numResults,type,includeDomains,excludeDomains,contents,category. - Fields we do not support are listed back in
ignoredFields, so nothing is dropped silently. - Not the same engine. Exa runs its own neural index. Ours is a metasearch over public engines, so every answer says
resolvedSearchType: "keyword". It is a drop-in for the request shape, not for Exa's ranking. - Speed from our own logs: the plain
/searchendpoint has a median of 2.0 s over 1,146 paid calls up to late October. The request above, with page text for 5 results, took 3 to 3.5 s in my runs today.
Use something else when
- You rely on Exa's neural ranking, find-similar or its own index: use Exa itself.
- You already have an Exa key and budget: there is no reason to switch.
- You run very high volume at a flat monthly price: a keyed plan is cheaper at scale.
- Your agent cannot hold a wallet or your company cannot pay in USDC.
- You need a written uptime guarantee: we are a small operator and offer none.
More plain answers like this one: cyberwarex.com/answers.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes โ full credit and traffic to the original publisher.