The same two tools with CrewAI's @tool decorator (async tools are supported by CrewAI). The paid one uses paid_client.py.
pip install crewai "x402[httpx,evm]" httpx
export EVM_PRIVATE_KEY=0x... # wallet with a little USDC on Base# CrewAI tool for X402 Router. pip install crewai "x402[httpx,evm]" httpx
# Put paid_client.py (from /examples) next to this file.
import httpx
from crewai.tools import tool
from paid_client import ROUTER, route_paid
@tool("Find x402 API (free)")
def find_x402_api_free(task: str, chain: str = "Base") -> dict:
"""Free: best live x402 (pay-per-call) API for a task, plus the top 3 matches with prices."""
return httpx.post(f"{ROUTER}/route", json={"q": task, "chain": chain}, timeout=30).json()
@tool("Find x402 API (ranked, 0.01 USDC)")
async def find_x402_api_ranked(task: str, chain: str = "Base", max_price: float = 0.05) -> dict:
"""Paid, 0.01 USDC: full ranked list (up to 25) of live x402 APIs for a task with latency, reliability,
price and payTo, plus a ready-to-pay best pick."""
return await route_paid(task, chain, max_price)
# from crewai import Agent
# scout = Agent(role="API scout", goal="Find a reliable paid API for the task", backstory="Knows the x402 ecosystem",
# tools=[find_x402_api_free, find_x402_api_ranked])
Free trial: 3 free trial calls per wallet per day, no payment needed. Add the header X-402-Trial: <your wallet address> (EVM 0x… or Solana) to /route/paid and you get the same full ranked answer a paid call gets. Limits: 3 per wallet and 3 per IP per UTC day, from a shared pool of 100 a day. After that you get the normal 402. Try it · trial.sh · trial_call.py
Test status (17 Nov 2026): crewai 1.15.41: both load as CrewAI Tool objects, and the paid tool's run() was run against a local replay of the router's live unsigned 402 (exact captured PAYMENT-REQUIRED header and body); the client produced a valid x402 v2 payment for 0.01 USDC (amount 10000) on eip155:8453 to the router's payTo. The signed payment was captured locally and never sent, so no funds moved. The Agent lines follow CrewAI's docs and were not executed (they need a model API key).
Prices: /route/paid 0.01 USDC, /check/paid 0.002 USDC, /route free. x402 v2 on Base (eip155:8453) or Solana. Machine-readable: OpenAPI · /.well-known/x402 · llms.txt