Skip to main content

Runtime service discovery for the x402 payment protocol — find x402-payable API endpoints at runtime

Project description

x402discovery

Runtime service discovery for the x402 payment protocol.

Find x402-payable API endpoints at runtime — no hardcoded URLs, no API key hunting. Works with any agentic framework.

Install

pip install x402discovery

Quick Start

from x402discovery import browse, discover

# Free catalog — no payment needed
services = browse()
print(f"{len(services)} services available")

# Filter by category
research_services = browse(category="research", max_price_usd=0.10)

# Search by keyword
data_services = browse(query="web scraping")

# Get the best service for a task
from x402discovery import X402DiscoveryClient

client = X402DiscoveryClient(max_price_usd=0.20)
best = client.best(category="data")
if best:
    print(f"Best service: {best['name']} at ${best['price_usd']}/call")
    print(f"Endpoint: {best['url']}")

API

browse(**kwargs) -> List[Dict]

Returns services from the free catalog, sorted by uptime% and latency.

Parameter Type Default Description
category str None Filter: research, data, compute, monitoring, generation, verification, routing, storage, other
max_price_usd float None Max price per call
query str None Text search on name + description
base_url str discovery API Override endpoint

discover(**kwargs) -> List[Dict]

Alias for browse() with a capability-focused interface.

health_check(service_id) -> Dict

Live health status for a specific service.

from x402discovery import health_check

status = health_check("legacy/cf-pay-per-crawl")
print(status["health_status"])  # "verified_up"
print(status["uptime_pct"])     # 100.0

X402DiscoveryClient

Stateful client with caching (default 5-minute TTL).

from x402discovery import X402DiscoveryClient

client = X402DiscoveryClient(max_price_usd=0.10, cache_ttl=60)
services = client.browse(category="research")
best = client.best(category="data")
print(client.format_results(services))

Service Schema

Each service dict contains:

{
    "id": "cf-pay-per-crawl",
    "service_id": "legacy/cf-pay-per-crawl",
    "name": "Cloudflare Pay Per Crawl",
    "description": "Access web content via Cloudflare's pay-per-crawl...",
    "url": "https://...",
    "category": "data",
    "price_usd": 0.001,
    "network": "base",
    "uptime_pct": 100.0,
    "avg_latency_ms": 67,
    "health_status": "verified_up",  # verified_up | unverified | verified_down
    "agent_callable": True,
    "auth_required": False,
    "llm_usage_prompt": "To use ...",  # pre-written prompt for LLM context
    "sdk_snippet_python": "import requests\n..."
}

Framework Plugins

Use framework-specific packages for native integration:

Framework Package
LangChain pip install langchain-x402-discovery
AutoGen pip install autogen-x402-discovery
CrewAI pip install crewai-x402-discovery
LlamaIndex pip install llama-index-x402-discovery

Discovery API

The underlying API: https://x402-discovery-api.onrender.com

  • GET /catalog — free, full service catalog
  • GET /health/{id} — live health check
  • GET /.well-known/x402-discovery — well-known discovery endpoint
  • GET /discover?q=... — x402-gated ($0.005/query) enhanced search

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

x402discovery-0.1.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

x402discovery-0.1.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file x402discovery-0.1.1.tar.gz.

File metadata

  • Download URL: x402discovery-0.1.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for x402discovery-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f7eea7b126769e0bb8b11340eaac1ac0ea72ccd879d82d2cc32fe2376d40dd43
MD5 813872b1804f217b9baa657c656e269e
BLAKE2b-256 0c8f34d5618645e08c6bbd6bd332fa1219ff654b600be8c5d895a2a2dd7edc18

See more details on using hashes here.

File details

Details for the file x402discovery-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: x402discovery-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for x402discovery-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dd4f902adc12c84a253aed8539caa5d62ed1e424cd2e6e8e3b566cee7c869a5e
MD5 df2ca591482d3dad3a56083667c60490
BLAKE2b-256 42c7e95fc4bf63eebd0118af7bcda8ab8b639cc304f78afb51325c5a907c169a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page