How do AI agents pay for an API?
说明与用途
AI 代理通过响应 HTTP 402 挑战、签署支付并在 PAYMENT-RESPONSE 标头中接收收据来为 API 付费。
问题
AI agents need a way to pay for API calls without human intervention.
结果
Agents can pay per read using a 402 challenge, sign the payment, and receive a receipt via PAYMENT-RESPONSE header.
工作流
- Agent requests a page or data call
- Server responds with HTTP 402 and price details
- Agent signs payment for the exact amount
- Agent resends the request with payment proof
- Facilitator verifies payment and settles on Base
- Server returns the requested data with PAYMENT-RESPONSE header
证据
An AI agent pays when a server sends a 402 challenge. It signs the exact request, retries, and the PAYMENT-RESPONSE header is its receipt.
The 402 header lists price, currency, and network.
Here the price is 0.001 USDC per accepted read. The network is Base, chain eip155:8453. The protocol is x402 version 2.
The agent signs a payment for that exact amount. It sends the same request again with proof attached.
The server then returns the data it promised. The reply carries a PAYMENT-RESPONSE header as the receipt.
- 记录日期: 2026-11-02T00:13:49.480Z