Updated

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.price with mode: "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" and network: "eip155:8453" (Base), plus the PAYMENT-REQUIRED header 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]
  1. Before each call, check spent + price <= budget. If not, stop and return your own 402/“budget exhausted” to the agent.
  2. Optionally make the unpaid request first and read price.usd from the 402 body as a live check.
  3. 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

Other sources

Compare