← 返回
开发者工具 中文

x402 Private Search

Make paid API requests using the x402 HTTP payment protocol (USDC on Base Sepolia). Use when you need to access x402-protected services, pay for API calls wi...
使用 x402 HTTP 支付协议(Base Sepolia 上的 USDC)发起付费 API 请求。当需要访问受 x402 保护的服务时使用。
kodos-vibe
开发者工具 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 1,031
下载
💾 9
安装
1
版本
#agent#latest#privacy#search#web-search#x402

概述

x402 Client

Make HTTP requests to x402-protected APIs. The x402 protocol uses HTTP 402 responses to request payment — this skill handles signing USDC payments and retrying automatically.

Prerequisites

  • Node.js 18+ installed
  • A Base Sepolia wallet with ETH (gas) and USDC (payments)

First-Time Setup

1. Install dependencies

bash <skill-dir>/scripts/setup.sh

This installs the x402 SDK to ~/.x402-client/. Only needed once.

2. Generate a wallet (if you don't have one)

node <skill-dir>/scripts/wallet-gen.mjs --out ~/.x402-client/wallet.key

3. Fund the wallet

Get testnet tokens from faucets:

  • Base Sepolia ETH (gas): https://www.alchemy.com/faucets/base-sepolia
  • Base Sepolia USDC (payments): https://faucet.circle.com/ → select Base Sepolia + USDC

Send both to the wallet address printed by wallet-gen.

4. Store the key

Set the environment variable for future use:

export X402_PRIVATE_KEY=$(cat ~/.x402-client/wallet.key)

Or pass --key-file ~/.x402-client/wallet.key to each request.

Making Paid Requests

Use x402-fetch.mjs to make any x402-paid HTTP request:

# Search the web ($0.001 USDC per query)
node <skill-dir>/scripts/x402-fetch.mjs \
  "https://<service-url>/web/search?q=latest+AI+news&count=5" \
  --key-file ~/.x402-client/wallet.key

The script automatically:

  1. Makes the HTTP request
  2. If 402 received, parses payment requirements
  3. Signs a USDC payment with your wallet
  4. Retries with the payment header
  5. Outputs the response JSON to stdout

All scripts must be run from ~/.x402-client/ (where node_modules lives):

cd ~/.x402-client && node <skill-dir>/scripts/x402-fetch.mjs "<url>" --key-file wallet.key

Known Services

See references/services.md for a list of known x402 endpoints including a web search service.

Troubleshooting

  • "insufficient funds": Wallet needs more USDC or ETH. Use faucets above.
  • 402 with no auto-payment: Ensure setup.sh was run and you're executing from ~/.x402-client/.
  • Tunnel URL not working: The service URL may have changed. Ask the service operator or check /health.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 08:19 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Agent Browser

matrixy
专为AI智能体优化的无头浏览器自动化CLI,支持无障碍树快照和基于引用的元素选择。
★ 427 📥 118,326
developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,834
developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 68 📥 180,365