HTTP 402 is not reserved for future use anymore: I put a 1-cent paywall on a live API for AI agents
Описание и применение
В статье описывается реализация 1‑центной оплаты через HTTP 402 и протокол x402, позволяющая AI‑агентам оплачивать одноразовый запрос без регистрации и ключей, используя стабильный токен на сети Base.
Задача
Traditional API key models require onboarding and are unsuitable for one‑off AI agent requests, leading to missed payments and high friction.
Результат
A live API now accepts 1‑cent payments via stablecoin, eliminating onboarding, chargebacks, and merchant identity requirements, making it viable for small operators and AI agents.
Рабочий процесс
- 1. Agent sends request to endpoint without payment header.
- 2. Server responds 402 with x402 challenge body (payment requirements).
- 3. Agent signs EIP‑712 authorization for exact amount and retries with X‑PAYMENT header.
- 4. Server verifies signature via facilitator, settles stablecoin transfer, and returns JSON result.
Доказательства
The challenge is public, the paid call costs one cent, and the data behind it is a free CC BY 4.0 dataset.
An agent reads accepts, signs an EIP‑712 authorization for exactly that amount, retries with an X‑PAYMENT header, and gets the JSON.
- Дата записи: 2026-09-22T07:45:25.801Z