x402 Protocol: How AI Agents Pay for API Calls with USDC Micropayments
DevForgeWhat is x402?
x402 is a new protocol that lets AI agents pay for API calls using USDC stablecoin micropayments. It extends the HTTP 402 "Payment Required" status code into a practical, working system for machine-to-machine commerce.
No API keys. No subscriptions. No accounts. Just pay per request.
How It Works
1. An AI agent makes an HTTP request to a paid endpoint
2. The server returns HTTP 402 with pricing info and a payment address
3. The agent sends USDC on Base (Ethereum L2, ~$0.001 gas fees)
4. The agent retries the request with a payment receipt in the header
5. The server verifies payment and returns the response
Why This Matters
Traditional APIs require signup, email verification, API keys, and billing setup. For autonomous AI agents that need to access hundreds of services, this creates massive friction.
x402 eliminates all of that. An AI agent with a USDC wallet can access any x402-enabled API instantly. This is the infrastructure layer for the AI agent economy.
Try It: DevForge x402 Endpoints
DevForge offers 10 x402-enabled endpoints you can test right now:
TextForge API (text processing):
- Text summarization: $0.005/call
- Sentiment analysis: $0.002/call
- Key phrase extraction: $0.002/call
- Language detection: $0.002/call
- Named entity recognition: $0.003/call
FetchForge API (web scraping):
- Fetch any URL: $0.001/call
- Extract content: $0.002/call
- Web search: $0.003/call
- Batch fetch: $0.005/call
- URL monitoring: $0.002/call
Check Pricing
curl http://69.62.106.38:3100/x402/pricing
curl http://69.62.106.38:3108/x402/pricing
Free Endpoints (No Payment Required)
DevForge also has 18+ free endpoints that require no payment and no API key:
curl http://69.62.106.38:3100/uuid
curl http://69.62.106.38:3100/ip
curl http://69.62.106.38:3100/now
curl http://69.62.106.38:3100/hash/sha256/hello
curl http://69.62.106.38:3100/dns/github.com
MCP Server (25 Free AI Tools)
For Claude Code, Cursor, and Windsurf users, DevForge also provides a free MCP server with 25 developer tools:
claude mcp add devforge --transport streamable-http http://69.62.106.38:3109/mcp
Includes: web_search, fetch_page, domain_info, ip_info, http_request, json_query, regex_test, cron_explain, hash, base64, uuid, timestamp, jwt_decode, color_convert, and more.
Resources
x402 Protocol: https://www.x402.org
x402 Directory: https://www.x402scan.com
DevForge Hub: http://69.62.106.38:3102
TextForge API: http://69.62.106.38:3100
FetchForge API: http://69.62.106.38:3108