使用说明
x402 API网络
人工智能代理的微付费API网络。按API调用付费,在L2基础上使用USDC。
与 x402协议 --需要HTTP 402付款。
实时API
基本URL: https://x402.fatihai.app
发现:
GET /--免费端点列表GET /.well-known/x402--机器可读清单GET /llms.txt--AI爬虫发现GET /health--健康检查
可用API(16个端点)
高价值API
| 端点 | 方法 | 价格 | 描述 |
|---|---|---|---|
/api/verify-email |
POST | $0.01 | 电子邮件验证:语法、MX、一次性、基于角色、0-100分 |
/api/domain-health |
POST | 0.01美元 | 域名电子邮件健康状况:MX、SPF、DKIM、DMARC分析 |
/api/scrape |
GET | $0.01 | 网络抓取:文本、链接、图像、标题提取 |
/api/ai-generate |
POST | 0.05美元 | 人工智能内容生成(Llama 3.3 70B):博客、电子邮件、社交、搜索引擎优化 |
实用程序API
| 端点 | 方法 | 价格 | 描述 |
|---|---|---|---|
/api/dns-lookup |
获取 | $0.001 | DNS记录(A、AAAA、MX、TXT、NS) |
/api/whois |
获取 | 0.005美元 | WHOIS域名信息 |
/api/ip-info |
GET | $0.001 | IP反向DNS和类型检测 |
/api/qr-code |
GET | 0.002美元 | 二维码生成(base64 PNG) |
/api/url-meta |
GET | $0.003 | URL元数据提取(标题、OG标签) |
/api/html-to-markdown |
GET | 0.002美元 | HTML到Markdown的转换 |
/api/ssl-check |
GET | 0.003美元 | SSL/TLS证书详细信息 |
/api/http-headers |
GET | $0.001 | HTTP响应头 |
/api/password-strength |
GET | $0.001 | 密码强度分析 |
/api/text-stats |
GET | $0.001 | 文本单词/句子/阅读时间统计 |
/api/json-format |
POST | $0.001 | JSON格式化和验证 |
/api/base64 |
POST | 0.001美元 | Base64编码/解码 |
运作原理
- 向任何API终结点发送请求
- 接收标头中包含付款要求的HTTP 402
- 使用您的钱包签署USDC小额支付(Base L2)
- 重新发送请求
PAYMENT-SIGNATURE头球 - 接收API响应
付款详情
- 网络: 基础主网(EIP-155:8453)
- 货币: 美元
- 主持人: Coinbase CDP
- 燃气费: 每笔交易约0.0001美元
快速开始
适用于AI代理(x402客户端)
import { x402Client } from '@x402/core/client';
const client = new x402Client({
privateKey: '0xYourPrivateKey',
network: 'eip155:8453',
});
const result = await client.get('https://x402.fatihai.app/api/dns-lookup?domain=google.com');
console.log(result);
MCP集成(克劳德桌面)
看 claude-desktop-config.example.json 用于Claude Desktop MCP集成。
直接卷曲(自由模式/显影)
# Email verification
curl -X POST https://x402.fatihai.app/api/verify-email \
-H "Content-Type: application/json" \
-d '{"email":"user@example.com"}'
# AI content generation
curl -X POST https://x402.fatihai.app/api/ai-generate \
-H "Content-Type: application/json" \
-d '{"topic":"AI micropayments","type":"blog_post"}'
# Web scraping
curl "https://x402.fatihai.app/api/scrape?url=https://example.com"
自我寄宿
git clone https://github.com/user/x402-api-network.git
cd x402-api-network
npm install
cp .env.example .env # Configure wallet and CDP keys
npm start
环境变量
| 变量 | 描述 |
|---|---|
PORT |
服务器端口(默认值:4021) |
WALLET_ADDRESS |
您的EVM钱包地址(接收付款) |
WALLET_PRIVATE_KEY |
钱包私钥 |
CDP_API_KEY_ID |
Coinbase开发者平台API密钥ID |
CDP_API_KEY_SECRET |
CDP API密钥机密 |
NETWORK |
链ID(默认值:eip155:8453表示Base) |
GROQ_API_KEY |
Groq API人工智能内容生成密钥 |
建筑
x402 API Network
├── server.js # Express server + x402 middleware + 16 API handlers
├── mcp-server.js # MCP server for Claude Desktop integration
├── .well-known/x402 # Machine-readable discovery manifest
├── /llms.txt # AI crawler discovery
└── /health # Health check endpoint
发现
此API可通过以下方式发现:
- x402集市 --CDP主持人
/discovery/resources端点 .well-known/x402--标准机器可读清单llms.txt--AI搜索引擎优化- DNS TXT —
_x402.x402.fatihai.app发现记录 - 主控程序 --Claude/ChatGPT的模型上下文协议服务器
许可证
麻省理工学院