Control cost and latency

Every agent turn spends on two meters at once, model tokens and API credits, and the user pays a third in seconds. Make all three visible, stop paying twice for the same answer, and give each conversation a budget it cannot exceed.

A single tool call looks cheap: a credit or two, a few hundred milliseconds. An agent multiplies it in ways a normal program does not. It decides how many calls to make. It sends the whole conversation, tool definitions included, back to the model on every turn. And it waits for a model round trip between each step. A question that needed two lookups can turn into eight turns, fifteen calls and twelve seconds if nothing is watching.

This lesson makes the costs visible and then puts limits on them. None of it requires a cleverer model; all of it lives in the tool layer and loop you have already built.

Three meters on every conversation

Model tokens. Each request in the loop is billed for its input (system prompt, tool definitions, every prior message and tool result) and its output. Because the history is resent, a long tool result is paid for on every later turn, not once.

API credits. Each successful APIVerve call costs a fixed number of credits, set per API. You can see it on each marketplace page, in the tokenUse field of the API's definition, and in the description of every tool the APIVerve MCP server exposes, which ends with the cost. The tools used in this course:

Tool backendCredits per callNotes
Unit Converter1Pure function of its input
Date Calculator1Pure function of its input
Exchange Rate, World Time2Live data
Email Validator20Live DNS checks per address

A twenty-to-one spread inside one small tool set is normal. An agent that validates every address mentioned in a long email thread spends more than one that answers a hundred unit questions.

Seconds. Latency in an agent is mostly round trips. Each turn is one model request plus whatever tools run before the next. Tool calls that run one after another add up; a turn that could have made three calls at once but made them over three turns adds two whole model requests.

Check yourself

A tool returns a 6 KB JSON response on turn 2 of a 6-turn conversation. Roughly how many times is that response billed as model input tokens?

Answer the check above to continue.

Run every example on your own key. Free plan, no card.

Scaling up?

Volume pricing, custom SLAs, and dedicated support for high-traffic teams.

Contact sales