-
Notifications
You must be signed in to change notification settings - Fork 969
Open
Description
Summary
Propose adding a standard /.well-known/x402 endpoint to the x402 specification, enabling direct discovery of x402-enabled services without relying on facilitators.
Background
Currently, x402 v2 uses Bazaar Discovery via facilitators:
- Services declare metadata via SDK extensions
- Facilitators catalog during payment processing
- Clients query
GET {facilitator}/discovery/resources
However, there's no standard way to discover services directly from the origin. Some projects have implemented their own versions:
Live Example: BlockRun
URL: https://blockrun.ai/.well-known/x402
curl https://blockrun.ai/.well-known/x402Response:
{
"x402Version": 2,
"name": "BlockRun",
"description": "Crypto-native AI gateway for permissionless LLM access via x402 micropayments on Base",
"version": "0.1.0",
"resource": {
"url": "https://api.blockrun.ai",
"description": "BlockRun AI Gateway API",
"mimeType": "application/json"
},
"services": [
{
"name": "LLM Chat Completion",
"endpoint": "/v1/chat/completions",
"method": "POST",
"description": "Access 20+ frontier LLMs with pay-per-request x402 micropayments",
"models": [
{
"id": "openai/gpt-5.2",
"name": "GPT-5.2",
"provider": "openai",
"contextWindow": 400000,
"maxOutput": 128000,
"categories": ["chat", "reasoning", "coding", "vision"]
}
// ... 20+ more models
],
"pricing": {
"openai/gpt-5.2": { "inputPerMillionTokens": "2.50", "outputPerMillionTokens": "10.00" }
},
"payment": {
"network": "base",
"networkName": "Base Mainnet",
"chainId": 8453,
"token": "USDC",
"tokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"recipient": "0x...",
"facilitator": "coinbase-cdp",
"scheme": "exact",
"maxTimeoutSeconds": 300
},
"authentication": {
"type": "x402-wallet",
"description": "Sign requests with your wallet private key - no API keys required",
"walletBased": true
},
"features": [
"OpenAI-compatible API",
"No accounts or API keys required",
"Permissionless access",
"Pay-per-request micropayments"
]
}
],
"documentation": {
"sdks": [{ "language": "TypeScript", "package": "@blockrun/llm" }]
},
"x402Features": [
"wallet-based-identity",
"auto-discovery",
"transparent-pricing",
"base-mainnet",
"coinbase-cdp-facilitator"
]
}Benefits of Standardization
- Direct Discovery - Clients can discover services without querying facilitators
- Self-Reported Metadata - Origins provide authoritative information
- Offline Discovery - No dependency on facilitator availability
- MCP Integration - AI agents can discover x402 services directly
- Ecosystem Growth - Lower barrier for aggregators and discovery tools
Proposed Structure
interface X402WellKnown {
// Required
x402Version: number;
name: string;
// Optional metadata
description?: string;
version?: string;
// Services/resources
resources?: Array<{
url: string;
type: "http";
method: string;
description?: string;
// Payment requirements
accepts: Array<{
scheme: "exact" | "subscription";
network: string; // CAIP-2 format: "eip155:8453"
asset: string;
payTo: string;
maxAmountRequired: string;
maxTimeoutSeconds: number;
}>;
// v2 Bazaar metadata
metadata?: {
input?: object; // Example input
output?: object; // Example output
inputSchema?: object; // JSON Schema
outputSchema?: object; // JSON Schema
};
}>;
// Optional
facilitators?: string[]; // Preferred facilitators
documentation?: {
url?: string;
sdks?: Array<{ language: string; package: string }>;
};
}Use Cases
1. AI Agent Discovery
// Agent discovers x402 services directly
const response = await fetch('https://api.example.com/.well-known/x402');
const services = await response.json();
// Agent can now understand available endpoints and pricing2. Aggregator Indexing
// Discovery service probes origins directly
for (const domain of knownOrigins) {
const wellknown = await fetch(`https://${domain}/.well-known/x402`);
if (wellknown.ok) {
await index(domain, await wellknown.json());
}
}3. IDE/Tooling Integration
// IDE can show available x402 endpoints with pricing
const x402Info = await fetchWellKnown(projectUrl);
// Display in autocomplete with cost estimatesQuestions for Discussion
- Should this be part of core x402 or an optional extension?
- How should it interact with Bazaar discovery?
- Should facilitator preference be includable?
- Caching recommendations (Cache-Control headers)?
Related
- x402 Bazaar Discovery: https://docs.cdp.coinbase.com/x402/bazaar
- RFC 8615 Well-Known URIs: https://www.rfc-editor.org/rfc/rfc8615
- OAuth 2.0 uses
/.well-known/oauth-authorization-server - OpenID uses
/.well-known/openid-configuration
Metadata
Metadata
Assignees
Labels
No labels