Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

🤖💸 How an AI Agent Pays for an API Without an API Key (x402 in Practice)

Описание и применение

Агент может оплачивать отдельные вызовы API без ключа, используя протокол x402, который возвращает цену и адрес для оплаты, после чего агент переводит USDC и повторяет запрос с доказательством оплаты.

Задача

Autonomous agents cannot use traditional API key workflows because they cannot create accounts, accept terms, or enter credit cards for pay‑per‑call services.

Результат

Agents can autonomously pay for individual API calls without storing or rotating API keys, enabling pay‑per‑call, zero‑tier, and composable machine‑to‑machine interactions.

Рабочий процесс

  • Send GET request to endpoint without authentication
  • Receive HTTP 402 with X‑PAYMENT header containing price, network, and pay‑to address
  • Build an on‑chain USDC transfer for the exact amount on the specified network
  • Retry the same request with X‑PAYMENT header containing the payment proof
  • Server verifies on‑chain payment, settles, and returns signed data

Доказательства

HTTP/1.1 402 Payment Required
X-PAYMENT: version=2, chain=base, max-total=10000 (0.01 USDC),
pay-to=0x4ff893...a4D5e9, resource="crypto-price"

Источник

The server verifies the payment on-chain, settles it, and returns the data. On xynaptic.io every response is also signed with Ed25519, and every proof is auditable at api.xynaptic.io/trust.

Источник

  • Дата записи: 2026-10-18T16:11:02.034Z