Cap agent spend per call with fixed x402 prices
Agent builders on X keep making the same point: reserve the maximum cost of a call before it runs, and refuse the call once a cap is hit. Checking spend afterwards is just reporting. FastAF is built so that this works without guesswork.
Why it works with FastAF
- The price is fixed per route and published up front. Every route in https://api.fastaf.co/openapi.json carries
x-payment-info.pricewithmode: "fixed"and an exact USD amount. - The 402 reply repeats the price before you pay. An unpaid request returns HTTP 402 with
price.usd,asset: "USDC"andnetwork: "eip155:8453"(Base), plus thePAYMENT-REQUIREDheader for x402 v2 clients. - You are charged only on success. The 402 body says: “Settled only if the request succeeds.”
Price table (from the OpenAPI spec, 28 Oct 2026)
| Price per call | Routes |
|---|---|
| $0.003 | serp, search, amazon, reddit |
| $0.005 | maps, youtube, scrape, news, scholar, jobs, linkedin_jobs, patents, flights, bing, walmart, zillow, ebay, x, screenshot |
| $0.010 | shopping, ai, images |
| $0.060 | linkedin (public profiles) |
Pattern: reserve, call, release
import requests
BUDGET_USD = 0.50
PRICES = {} # loaded once from the spec
spec = requests.get("https://api.fastaf.co/openapi.json").json()
for path, ops in spec["paths"].items():
info = ops.get("get", {}).get("x-payment-info", {})
if "price" in info:
PRICES[path] = float(info["price"]["amount"])
spent = 0.0
def can_call(path):
return spent + PRICES[path] <= BUDGET_USD
def record(path, ok):
global spent
if ok: # FastAF settles only successful requests
spent += PRICES[path]
- Before each call, check
spent + price <= budget. If not, stop and return your own 402/“budget exhausted” to the agent. - Optionally make the unpaid request first and read
price.usdfrom the 402 body as a live check. - Pay with your x402 client only when the reserve fits.
Prefer a key instead?
The same 402 body offers an account path: 500 free credits every month after verifying your email at https://fastaf.co/signup/, then optional prepaid credits.
Related: x402 scraping API, pay per call · Google SERP API · Why agent retries cost more than you think
Reference
- x402 documentation: every parameter and response field
- Docs: authentication, errors, MCP and x402
- Pricing: credit packs from $10, without expiry
Other sources
- How to read public Amazon data when your requests fail
- How to read public Google Search data when your requests fail
- How to read public Walmart data when your requests fail
- How to read LinkedIn data with an API
- How to read public eBay data when your requests fail
- How to read public Booking.com data when your requests fail
- How to read X profile data with an API
- How to read public Zillow data when your requests fail
- Pay-per-call web scraping for AI agents with x402
- MCP servers for Amazon, SERP and web scraping
- Cost per agent: monthly SaaS vs x402 pay-per-call
- How FastAF handles heavy pages and timeouts
- x402 endpoint discovery checklist: how agents find a paid API (and how FastAF passes it)
- Add FastAF to Claude Code, Codex and Cursor
- How to detect poisoned or incomplete SERP results in AI agents
- Use FastAF from the Cloudflare Agents SDK
- FastAF as a fallback search provider
- Budget a scraping job before you run it
- Try FastAF for free, no card
- Too many MCP tools? Keep agent context small
- How agents find an API (and where FastAF is)
- Why agent retries cost more than you think
- All how-to guides