x402 · Base mainnet · USDC

Web search for LangChain agents, no API key

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.

Wrap it as a LangChain tool

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.

How your agent pays

  1. POST https://x402.eleeth.com/api/search with no payment header → HTTP 402 with payment requirements.
  2. Your agent signs a $0.01 USDC transfer and retries with the X-PAYMENT header.
  3. Payment is verified on-chain, results return as JSON.

Any x402 v2 client library (@x402/core / x402-fetch) handles this automatically.

FAQ

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