# Stop an AI agent overspending on APIs.

> Quote before every call, cap each call with maxUsd, fund a balance instead of a card, and read what each answer cost. Four controls for agent spend.

Canonical: https://apiforagents.dev/guides/stop-ai-agents-overspending · Updated 2026-10-16

An agent in a loop can spend a month's budget in minutes. Four controls stop that: an exact quote before each paid call, a hard per-call ceiling, a prepaid balance instead of an open card, and a cost line in every answer the agent can log.

- Quote: Free
- Per-call cap: maxUsd
- Balance: Prepaid
- Cost: In every answer

## 1. Quote first

json:

```json
{
  "op": "searchPeople",
  "company": "stripe",
  "titles": [
    "Head of Data"
  ],
  "limit": 25,
  "estimateOnly": true
}
```

## 2. Cap the call

json:

```json
{
  "op": "searchPeople",
  "company": "stripe",
  "titles": [
    "Head of Data"
  ],
  "limit": 25,
  "maxUsd": 0.1
}
```

## 3. Fund a balance, not a card

The agent spends from a prepaid balance a person tops up from $5. When it runs low the API answers payment_required with a top-up link for a person, and the agent stops. It can never add money itself.

## 4. Log the cost line

Every answer carries cost.usd (what was charged) and the balance left. Have the agent report both after each step so you see spend as it happens.

> **Put it in the prompt** Tell the agent: quote every paid call first with estimateOnly, tell me the price, set maxUsd on every call, and stop when the API asks for a top-up.

## Questions

### What happens if a call would cost more than maxUsd?

The API refuses it with budget_exceeded before spending anything, and returns the quote so the agent can ask you.

## Why API for Agents

- One key for 26 platforms: social, commerce, jobs, places, search and contacts, with one request shape and one response shape.
- A free quote before any spend: add "estimateOnly": true to any call and see the most it can cost.
- Pay per record in US dollars. No subscription, nothing expires, top-ups from $5.
- $0.10 free to try, no card. An AI agent can sign itself up in one request; a person claims it later.
- Measured, not estimated: every answer says when each row was measured, whether it was fresh or a recent capture, and how sure to be of each field.
- Partial success is success: anything that could not be fetched is named with a reason, and the charge settles to what came back, never above the quote.
- Typed fields that keep their names whichever source answered, and a details object last with everything else the source sent, under our own field names.
- Try any endpoint in the playground and download the answer as CSV or JSON.

## Start

The playground runs any endpoint by hand: pick a platform and what you want from it, fill a short form named in plain words (or press Use sample input), see the free quote on the Run button, run it, then read the answer as a table or JSON and download it as CSV or JSON. The same call is written out as cURL, Python and Node while you type. Open it at https://apiforagents.dev/dashboard/run (sign in first).

Agents register at https://apiforagents.dev/auth.md (one POST, $0.10 free). People: https://apiforagents.dev/docs#start. Prices: https://apiforagents.dev/pricing.md
