Every LangChain search integration wants an API key in an env var: another secret to provision, rotate, and leak. The x402 Search API has no keys at all — your agent pays $0.01 USDC per call straight from its wallet, so the tool is just a URL.
from langchain.tools import Tool
import requests
def x402_search(q: str) -> str:
# $0.01 USDC per call, paid via x402 (handled by your x402 client)
r = requests.get("https://x402.eleeth.com/api/search",
params={"q": q, "num": 5})
r.raise_for_status()
return r.text
search_tool = Tool(
name="web_search",
func=x402_search,
description="Search the web. Input: a query string. "
"Returns JSON with title/url/snippet results.",
)
Pair it with an x402-capable HTTP client (@x402/core / x402-fetch on the JS side) and the 402 → pay → retry flow happens automatically inside the tool call.
POST https://x402.eleeth.com/api/search with no payment header → HTTP 402 with payment requirements.X-PAYMENT header.Any x402 v2 client library (@x402/core / x402-fetch) handles this automatically.
Where do I put the API key? Nowhere — there isn't one. Fund the agent's wallet with USDC on the right network and go.
POST or GET? Either. GET /api/search?q= is the simplest tool wrapper; POST takes a JSON body with num_results.
What does the tool return? JSON: {"provider","query","results":[{"title","url","snippet"}]} — easy for the agent to parse and cite.
Run by Eleeth. Questions: seo@eleeth.com