websearch_search_web
Web search API: searches the web through a proxy and returns result titles, URLs and snippets
- Preço
- $0.009 USDC · por chamada
- Serviço
- Websearch
- Categoria
- Acesso web
- Endpoint
POST /v1/websearch/search_web
Performs a real internet search, ALWAYS fetched through a proxy sourced from `proxy-pool` -- the proxy itself is a FREE PUBLIC proxy; the small fee this tool charges (and the smaller fee it itself pays `proxy-pool`) is for the selection/verification SERVICE, not for the proxy. Never a direct/unproxied request, by design. Reuses a proxy this service has itself recently proven to work, when one is available, before paying `proxy-pool` for a fresh pick. Retries up to 8 times, each attempt through a different proxy, since a single dead/blocked free proxy is common, and always resolves to real results -- a zero-result parse is itself treated as a failure and retried, never returned as a silent empty response. **Response time varies noticeably as a result**: a cached or already-proven-good proxy answers quickly, while a cold search that needs several retries against slow free proxies can take up to roughly two minutes -- a deliberate trade-off for reliability over a fast failure, not an inconsistency. A repeat of the exact same query is served from a short-lived in-process cache instead of paying for and re-fetching again. Returns up to 10 results (title/url/snippet, with redirect links decoded back to the real destination URL). Free for the first few calls, then a real x402 payment (a `402` response carrying a `PAYMENT-REQUIRED` challenge) is required to continue. Free trial: 3 free calls per caller IP address, per tool, per 24 hours (and at most 50 free calls per window for this tool across all callers; MCP callers, whose address is not known, share a single anonymous free call). After that, every call is paid via x402 at $0.009 USDC per call.
Parâmetros
query | string · obrigatório | The search query text, e.g. `"rust async runtime comparison"`. |
|---|
Exemplo de pedido
O que o seu agente envia
{
"query": "x402 payment protocol"
}O curl simples para no desafio 402: adicione um cliente x402 (separadores Node.js ou Python) para pagar automaticamente.
# O curl simples para no desafio 402: adicione um cliente x402 (separadores Node.js ou Python) para pagar automaticamente.
curl -X POST 'https://api.17711.xyz/registry/websearch/v1/websearch/search_web' \
-H 'content-type: application/json' \
-d '{"query":"x402 payment protocol"}'O SDK x402 trata do 402, da assinatura e da repetição por si: uma chamada, um resultado.
// npm install @x402/fetch @x402/evm viem
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const signer = privateKeyToAccount(process.env.EVM_PRIVATE_KEY as `0x${string}`);
const client = new x402Client();
client.register("eip155:*", new ExactEvmScheme(signer));
const fetchWithPayment = wrapFetchWithPayment(fetch, client);
const res = await fetchWithPayment("https://api.17711.xyz/registry/websearch/v1/websearch/search_web", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({"query":"x402 payment protocol"}),
});
console.log(await res.json());O SDK x402 trata do 402, da assinatura e da repetição por si: uma chamada, um resultado.
# pip install "x402[httpx]" eth_account
import asyncio, os
from eth_account import Account
from x402 import x402Client
from x402.http.clients import x402HttpxClient
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact.register import register_exact_evm_client
async def main() -> None:
client = x402Client()
account = Account.from_key(os.environ["EVM_PRIVATE_KEY"])
register_exact_evm_client(client, EthAccountSigner(account))
async with x402HttpxClient(client) as http:
response = await http.post("https://api.17711.xyz/registry/websearch/v1/websearch/search_web", json={"query":"x402 payment protocol"})
await response.aread()
print(response.json())
asyncio.run(main())O cliente Java de referência do repositório x402. Ainda não existe um SDK Java publicado: fornece a assinatura (por exemplo com web3j).
// Reference client from github.com/coinbase/x402 (java/): build it with `mvn clean install`, then
// <dependency><groupId>org.x402</groupId><artifactId>x402</artifactId><version>1.0.0-SNAPSHOT</version></dependency>
import org.x402.client.X402HttpClient;
import org.x402.crypto.CryptoSigner;
import java.math.BigInteger;
import java.net.URI;
import java.net.http.HttpResponse;
import java.util.Map;
public class Call {
public static void main(String[] args) throws Exception {
// You provide the EIP-3009 signature (for example with web3j) from your private key (env EVM_PRIVATE_KEY).
CryptoSigner signer = new CryptoSigner() {
@Override
public String sign(Map<String, Object> payload) {
return signWithWallet(System.getenv("EVM_PRIVATE_KEY"), payload);
}
};
X402HttpClient client = new X402HttpClient(signer);
BigInteger amount = BigInteger.valueOf(9000); // $0.009 in USDC (6 decimals)
String usdcOnBase = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
String payTo = "<the seller address from the 402 challenge>";
HttpResponse<String> response = client.get(URI.create("https://api.17711.xyz/registry/websearch/v1/websearch/search_web"), amount, usdcOnBase, payTo);
System.out.println(response.body());
}
}O SDK x402 trata do 402, da assinatura e da repetição por si: uma chamada, um resultado.
// go get github.com/x402-foundation/x402/go/v2
package main
import (
"context"
"fmt"
"io"
"net/http"
"os"
"time"
"strings"
x402 "github.com/x402-foundation/x402/go/v2"
x402http "github.com/x402-foundation/x402/go/v2/http"
evm "github.com/x402-foundation/x402/go/v2/mechanisms/evm/exact/client"
evmsigners "github.com/x402-foundation/x402/go/v2/signers/evm"
)
func main() {
signer, _ := evmsigners.NewClientSignerFromPrivateKey(os.Getenv("EVM_PRIVATE_KEY"))
client := x402.Newx402Client().Register("eip155:*", evm.NewExactEvmScheme(signer))
httpClient := x402http.WrapHTTPClientWithPayment(http.DefaultClient, x402http.Newx402HTTPClient(client))
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.17711.xyz/registry/websearch/v1/websearch/search_web", strings.NewReader(`{"query":"x402 payment protocol"}`))
req.Header.Set("content-type", "application/json")
res, err := httpClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res.StatusCode, string(body))
}O SDK x402 trata do 402, da assinatura e da repetição por si: uma chamada, um resultado.
// Cargo.toml: x402-reqwest = "0.6", x402-chain-eip155, alloy-signer-local, reqwest, tokio (features = ["full"])
use alloy_signer_local::PrivateKeySigner;
use reqwest::Client;
use std::sync::Arc;
use x402_chain_eip155::V2Eip155ExactClient;
use x402_reqwest::{ReqwestWithPayments, ReqwestWithPaymentsBuild, X402Client};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let signer: Arc<PrivateKeySigner> = Arc::new(std::env::var("EVM_PRIVATE_KEY")?.parse()?);
let x402 = X402Client::new().register(V2Eip155ExactClient::new(signer));
let http = Client::new().with_payments(x402).build();
let res = http
.post("https://api.17711.xyz/registry/websearch/v1/websearch/search_web")
.header("content-type", "application/json")
.body(r#"{"query":"x402 payment protocol"}"#)
.send()
.await?;
println!("{} {}", res.status(), res.text().await?);
Ok(())
}O que o cliente x402 do seu agente faz nos bastidores (técnico, ilustrativo).
- 1
Chamar o endpoint
→POST https://api.17711.xyz/registry/websearch/v1/websearch/search_web content-type: application/json { "query": "x402 payment protocol" }←402 Payment RequiredHTTP/1.1 402 Payment Required PAYMENT-REQUIRED: <base64> { "x402Version": 2, "accepts": [ { "scheme": "exact", "network": "eip155:8453", "amount": "9000", "asset": "USDC", "payTo": "0x…" } ] } - 2
Assinar o pagamento (local)
A sua carteira assina localmente uma autorização USDC. Só a assinatura sai da sua máquina.
→wallet.sign(transferWithAuthorization, to: payTo, value: 9000 ($0.009 USDC), network: base)←signaturePAYMENT-SIGNATURE: <signed authorisation> - 3
Repetir com a assinatura
→POST https://api.17711.xyz/registry/websearch/v1/websearch/search_web PAYMENT-SIGNATURE: <signed authorisation> content-type: application/json { "query": "x402 payment protocol" }←200 OKHTTP/1.1 200 OK PAYMENT-RESPONSE: <settlement receipt> { … the tool's JSON answer … }
O SDK x402 faz os passos 2 e 3 por si.
Definição OpenAPI
Definição OpenAPI · websearch_search_web
{
"operationId": "websearch_search_web",
"summary": "Web search API: searches the web through a proxy and returns result titles, URLs and snippets ($0.009, x402)",
"description": "Performs a real internet search, ALWAYS fetched through a proxy sourced from `proxy-pool` -- the proxy itself is a FREE PUBLIC proxy; the small fee this tool charges (and the smaller fee it itself pays `proxy-pool`) is for the selection/verification SERVICE, not for the proxy. Never a direct/unproxied request, by design. Reuses a proxy this service has itself recently proven to work, when one is available, before paying `proxy-pool` for a fresh pick. Retries up to 8 times, each attempt through a different proxy, since a single dead/blocked free proxy is common, and always resolves to real results -- a zero-result parse is itself treated as a failure and retried, never returned as a silent empty response. **Response time varies noticeably as a result**: a cached or already-proven-good proxy answers quickly, while a cold search that needs several retries against slow free proxies can take up to roughly two minutes -- a deliberate trade-off for reliability over a fast failure, not an inconsistency. A repeat of the exact same query is served from a short-lived in-process cache instead of paying for and re-fetching again. Returns up to 10 results (title/url/snippet, with redirect links decoded back to the real destination URL). Free for the first few calls, then a real x402 payment (a `402` response carrying a `PAYMENT-REQUIRED` challenge) is required to continue. Free trial: 3 free calls per caller IP address, per tool, per 24 hours (and at most 50 free calls per window for this tool across all callers; MCP callers, whose address is not known, share a single anonymous free call). After that, every call is paid via x402 at $0.009 USDC per call.",
"x-price-usdc": "0.009",
"x-payment-info": {
"price": {
"mode": "fixed",
"currency": "USD",
"amount": "0.009000"
},
"protocols": [
{
"x402": {}
}
]
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "The search query text, e.g. `\"rust async runtime comparison\"`."
}
},
"required": [
"query"
]
},
"example": {
"query": "string"
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"url": {
"type": "string"
},
"snippet": {
"type": "string"
}
},
"required": [
"title",
"url",
"snippet"
]
}
}
},
"required": [
"results"
]
},
"example": {
"results": [
{
"title": "string",
"url": "string",
"snippet": "string"
}
]
}
}
}
},
"402": {
"description": "Payment required -- a free-call quota exists (default 5 calls, see PLATFORM_FREEMIUM_FREE_CALLS) before this status applies; beyond it, pay via the real x402 protocol (PAYMENT-REQUIRED response header, decode and retry with a signed PAYMENT-SIGNATURE header).",
"content": {
"application/json": {
"schema": {
"type": "object",
"description": "x402 v2 PaymentRequired challenge",
"properties": {
"x402Version": {
"type": "integer"
},
"error": {
"type": "string"
},
"resource": {
"type": "object",
"properties": {
"url": {
"type": "string"
},
"description": {
"type": "string"
},
"mimeType": {
"type": "string"
}
}
},
"accepts": {
"type": "array",
"items": {
"type": "object",
"properties": {
"scheme": {
"type": "string"
},
"network": {
"type": "string"
},
"amount": {
"type": "string",
"description": "Token atomic units, NOT decimal USD -- see x-payment-info.price.amount for the decimal form."
},
"asset": {
"type": "string"
},
"payTo": {
"type": "string"
},
"maxTimeoutSeconds": {
"type": "integer"
},
"extra": {
"type": "object"
}
}
}
}
},
"required": [
"x402Version",
"accepts"
]
}
}
}
},
"default": {
"description": "Standardized error envelope, on every non-2xx response from this fleet: {\"error\": {\"code\": <dotted string, e.g. \"request.bad_request\">, \"index\": <integer>, \"status\": <HTTP status code>, \"message\": <client-safe description>, \"debug\": <object, present only for an authorized caller>}}.",
"content": {
"application/json": {
"schema": {
"type": "object",
"description": "ErrorEnvelope"
}
}
}
}
}
}