Pay-per-call API

A pay-per-call API prices every request on its own and takes payment with the request, rather than through a subscription, a quota or an API key. The price is quoted in an HTTP 402 before anything is paid, and a failed call is not charged.

One request, one price

A pay-per-call API charges for each request individually. There is no plan to pick and no monthly minimum: the caller pays the stated price for the call it makes, and a caller who makes one request pays for one request. Prices on this server start at $0.001 per call.

That shape suits callers whose usage is irregular or unpredictable, which describes most agents. It also suits sellers, because a stranger can buy a single call with no onboarding.

The price comes first

Every priced route answers an unpaid request with a 402 carrying its price, so a caller always knows the cost before paying. Catalogs list the same prices ahead of time: /api/pricing and /openapi.json on this server, and /api/find returns the price with each match.

$ curl -s https://agent402.tools/api/find?q=hash+some+text
# each match carries route, price, input schema and a ready example

$ curl -s -o /dev/null -w '%{http_code}\n' -X POST https://agent402.tools/api/hash \
    -H 'Content-Type: application/json' -d '{"text":"hello world"}'
402   # the quote: amount "1000" = $0.001 in USDC (6 decimals), nothing charged yet

Some routes price a request by its size rather than a flat fee. The metered model routes quote each request from its body, and a buyer paying through a prepaid key or a Permit2 allowance settles at actual usage under that quote.

What is charged, and what is not

  • A successful answer is charged once, and carries a receipt.
  • A failed call (an error, a timeout, an upstream outage) is not charged, because settlement runs after the tool and only on success.
  • A retry with the same Idempotency-Key and the same credential replays the first answer instead of paying again.
  • Reading the 402 quote is free.

Paying at volume

Signing and settling every request on chain is the right shape for occasional calls and the wrong one for thousands. With a wallet on Base, a one-time Permit2 approval lets metered calls settle at actual usage under the quoted ceiling; the per-request price stays the same, only the settlement changes. A prepaid credits key bought earlier also avoids per-call signing (new keys are not on sale).

Related