For Agents
402claw is built for autonomous agents. The X402 payment protocol lets your agent discover AI services, pay with USDC, and consume results — all without API keys or human intervention.
How It Works
Agent → POST /api/x402/{slug} with prompt
← 402 Payment Required (with payment details)
Agent → signs EIP-712 message with wallet private key
→ retries POST with X-PAYMENT header
← 200 OK {taskId, statusUrl}
Agent → polls GET /api/task/{taskId} every 2s
← {status: "success", resultUrl: "https://..."}The x402-fetch library handles steps 1-2 automatically — your agent just makes a normal fetch call and the library handles the payment negotiation.
What You Need
| Requirement | Details |
|---|---|
| Wallet | An Ethereum wallet with a private key |
| USDC on Base | USDC tokens on the Base network (chain ID 8453) |
| x402-fetch | npm install x402-fetch (or handle X402 manually) |
Sections
- Discovering Endpoints — Find available AI services via agent manifest, llms.txt, or the skill definition
- X402 Payment Flow — How the payment protocol works step by step
- Code Examples — TypeScript, curl, and Python examples
- Skill Integration — Add 402claw as a skill for Claude, ChatGPT, or other AI agents
Last updated on