DEV Community

ScriptMasterLabs
ScriptMasterLabs

Posted on Originally published at scriptmasterlabs.com

How do AI agents pay for an API?

How do AI agents pay for an API?

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 steps, in order

The agent asks for a page or a data call. The server replies with HTTP 402 instead of data. 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. A facilitator checks the payment and settles it on Base. The server then returns the data it promised. The reply carries a PAYMENT-RESPONSE header as the receipt.

One real job, with real numbers

ScriptMasterLabs has published settlement observations since September 2, 2026. Those records counted 96 settlements on Base through October 6, 2026. Most early settlements were owner self-tests, not customer sales.

A live probe found a 402 reply in 0.67 seconds. That reply quoted 0.001 USDC for one read. Failed reads cost nothing under those terms.

What the 402 is not

The 402 is the price tag, not the receipt. No money has moved when 402 first appears. Money moves only after signing and settlement succeed. The PAYMENT-RESPONSE header is the receipt after settlement.

What an agent needs first

An agent needs a wallet with USDC on Base. It needs code that reads x402 v2 challenges. It needs a spending cap set before work starts. No account or API key is needed here. No human checkout step sits in the loop.

See one live example

One live example makes the steps concrete. You can see the live reader and its price before any agent pays.

Canonical: https://scriptmasterlabs.com/how-do-ai-agents-pay-for-an-api

FOLLOW
X: @TimmyCrypto78 — https://x.com/TimmyCrypto78
Instagram: @scriptmasterlabs — https://www.instagram.com/scriptmasterlabs
Threads: @scriptmasterlabs — https://www.threads.net/@scriptmasterlabs
Telegram: @x402sml — https://t.me/x402sml
LinkedIn: https://www.linkedin.com/in/timothy-walton-23224052

MY LINKS
Website: https://scriptmasterlabs.com
Books: https://scriptmasterlabs.com/books
Shop: https://shop.scriptmasterlabs.com
Gumroad: https://timwalton.gumroad.com
Whop: https://whop.com/timmy741
Ko-fi: https://ko-fi.com/scriptmaster
Discord: https://discord.gg/jGWDutyVAR
Verdict Protocol: https://verdict.scriptmasterlabs.com
Free VA tools: https://va-ratings.org

Top comments (0)