Skip to main content

x402serps

Python client for x402serps, a third-party search provider for AI agents.

Pay per call with x402 (USDC on Base or Solana), a prepaid credit key, or the 25-call trial. Search is $0.004 per 10 results. Extract is $0.003 per URL. MCP includes 20 free web_search / extract calls per day.

Two-minute quickstart (trial)

pip install x402serps
from x402serps import X402Serps

xs = X402Serps(trial=True)
print(xs.search("x402 payments protocol", num=5)["results"])

The trial covers /api/v1/search, news, extract, images, places, shopping, scholar and videos (25 calls per client network). After that, use a credit key or x402.

Prepaid credit key

Buy a key at pricing and pass it (or set X402SERPS_API_KEY):

from x402serps import X402Serps

xs = X402Serps(api_key="xs_...")
print(xs.search("x402 payments protocol")["results"])

Pay per call with x402 (Base or Solana)

The official x402 package wraps httpx.AsyncClient so a 402 is retried with a payment header. Use AsyncX402Serps and pass that client:

pip install "x402serps[x402]" "x402[httpx,evm]"
# For Solana: pip install "x402[httpx,svm]"
import asyncio
from x402 import x402Client
from x402.http.clients import wrapHttpxWithPayment
from x402.mechanisms.evm.exact import ExactEvmScheme
from x402serps import AsyncX402Serps

# `signer` is your EVM account signer (see x402 EVM docs).
x402 = x402Client()
x402.register("eip155:*", ExactEvmScheme(signer=signer))

async def main():
    http = wrapHttpxWithPayment(x402)
    async with AsyncX402Serps(client=http) as xs:
        data = await xs.search("x402 payments protocol")
        print(data["results"])

asyncio.run(main())

Register a Solana scheme the same way (ExactSvmScheme on solana:*) if you want to pay on Solana.

If a call is unpaid, the client raises PaymentRequiredError (status == 402) with accepts and any trial status header.

from x402serps import PaymentRequiredError, X402Serps

try:
    X402Serps().search("x402")
except PaymentRequiredError as err:
    print(err, err.accepts)

Async trial or credit-key client

import asyncio
from x402serps import AsyncX402Serps

async def main():
    async with AsyncX402Serps(trial=True) as xs:
        data = await xs.search("x402 payments protocol", num=5)
        print(data["results"], "remaining", xs.trial_remaining)

asyncio.run(main())

API

Every /api/v1 route has a method. Keyword arguments are merged into the JSON body.

Method Path Notes
search(q, **kw) /api/v1/search $0.004 / 10 results
news, images, places, shopping, scholar, videos matching path same search price
extract(url or urls, **kw) /api/v1/extract $0.003 / URL
search_extract, answer, crawl, map matching path
batch(queries, **kw) /api/v1/batch
research, visibility, competitor_report, leads, seo_audit, news_digest matching path paid endpoints, not in the trial
balance() /api/v1/balance credit key
create_monitor, list_monitors, get_monitor, delete_monitor /api/v1/monitors

Use request(path, body, method) for a custom path (for example with schemas from tools.json). After a trial call, xs.trial_remaining holds the remaining quota when the server sends it.

LangChain

Install langchain-x402serps for ready-made tools, or wrap this client yourself:

from langchain_core.tools import tool
from x402serps import X402Serps

xs = X402Serps(trial=True)

@tool
def web_search(query: str) -> str:
    """Search the web for current information."""
    return str(xs.search(query, num=8)["results"])

More

Metadata

Release files for x402serps 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for x402serps 1.0.0
File Size Uploaded Provenance Actions
x402serps-1.0.0.tar.gz 5.9 kB Without provenance Details for x402serps-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for x402serps 1.0.0
File Interpreter ABI Platform Actions
x402serps-1.0.0-py3-none-any.whl Python 3 none any Details for x402serps-1.0.0-py3-none-any.whl

Total release size: 13.2 kB

Release files / x402serps-1.0.0.tar.gz

Download URL x402serps-1.0.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
37c5aaea4f1cb609aa7280faf31682da44eff4529582837482b0a657b6f3aa6d
BLAKE2b-256 checksum
How to use checksums
c959a8f581c95c02c6c983214cb76bcb1c63a80de96b3a520cc1f4ae044cbf45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / x402serps-1.0.0-py3-none-any.whl

Download URL x402serps-1.0.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae9ccd375cbf2578b1993a029c730e28c928ebf972e610392f487e97086fa773
BLAKE2b-256 checksum
How to use checksums
9787ed92b8cd98d0ffbd15596f129d3dd91c79a8f92cff0bf030267405a8bb18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for x402serps 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page