CyberWareX 示範 AI 智能體免 API key 接入即時網頁搜尋,每次 $0.003
Give your AI agent live web search for $0.003 a query, no API key
CyberWareX 示範讓 AI 智能體透過 x402,在 Base 上以 USDC 按次付費進行即時網頁搜尋,每次 $0.003,毋須註冊或 API key。文章提供 Python 和 TypeScript 接入程式碼,並列出搜尋、新聞、網頁內容、論文及答案等端點的收費。每個 IP 每日可免費呼叫 3 次,搜尋結果為零時不收費。
Your agent can't Google. Every "research agent" tutorial hand-waves this step: you go get a search API key,
put it in an env file, set up billing, and hope the key never leaks out of a prompt.
There is a simpler way now that x402 exists: the agent pays for each query itself, from its own wallet,
in USDC on Base. No signup, no key, no plan. Here is the whole integration.
1. Try it free from your terminal
curl -H "X-Free-Trial: 1" \
"https://search.cyberwarex.com/search?q=x402+payment+protocol&n=3"
You get back plain JSON: title, url, snippet, source engine. Three free calls a day per IP, no account.
2. Paid path: 5 lines
Python:
pip install x402 eth-account
from x402.clients.requests import x402_requests
from eth_account import Account
s = x402_requests(Account.from_key(PK)) # a wallet with a little USDC on Base
r = s.get("https://search.cyberwarex.com/search", params={"q": "latest base chain news", "n": 5}).json()
for hit in r["results"]:
print(hit["title"], hit["url"])
TypeScript:
npm i x402-fetch viem
import { wrapFetchWithPayment } from "x402-fetch";
import { privateKeyToAccount } from "viem/accounts";
const f = wrapFetchWithPayment(fetch, privateKeyToAccount(PK));
const r = await f("https://search.cyberwarex.com/search?q=latest+base+chain+news&n=5");
const { results } = await r.json();
What happens under the hood: the first request gets an HTTP 402 with a price quote ($0.003 = 3000 micro-USDC),
the client signs an EIP-3009 authorization, retries with an X-PAYMENT header, and the server settles it through
the Coinbase facilitator. Gasless for the payer. Queries that return zero results are not charged.
3. The rest of the research loop, same host
| Call | What you get | Price |
|---|---|---|
| /search?q= | up to 10 web results | $0.003 |
| /news?q= | ranked, corroborated headlines with age in minutes | $0.001 |
| /contents?url= | one page as clean markdown, JS rendered | $0.002 |
| /search-contents?q= | search + the readable text of each result page | $0.006 |
| /papers?q= | arXiv, PubMed, Semantic Scholar, OpenAlex | $0.003 |
| /answer?q= | a concise cited answer built from live pages | $0.03 |
/search-contents is the one I would start with for a research agent: it collapses the search-then-fetch
loop into one paid call.
4. If you don't want to sign every call
Top up once and use a header instead:
r = s.get("https://safe.cyberwarex.com/subscribe?usd=3").json() # $3 -> $3.30 credit -> 1,100 searches
requests.get("https://search.cyberwarex.com/search", params={"q": q},
headers={"X-Subscription-Key": r["key"]})
Why not just a free search API
Free tiers are shared resources with per-IP limits and surprise deprecations. A key is a secret your agent
has to carry. Here the wallet is the credential, the price is $0.003 (typical x402 web search is $0.01),
and the results are Google-grade. Uptime and probes are public on x402-list.com.
Quickstart page: https://cyberwarex.com/assets/search-quickstart.html
Docs for agents: https://search.cyberwarex.com/llms.txt
來源:DEV Community · dev.to