Guides / Guide

How to control AI agent costs before they happen

Updated · By the Nexus team

Give every agent its own monthly budget, and check that budget before a run starts rather than after it finishes. Then cap each run, route routine steps to a cheaper model, require approval for anything expensive, and review the per-agent cost log weekly. Alerts after the fact tell you what already went wrong; a pre-execution check stops it.

Why agent bills surprise people

A chat reply costs a few thousand tokens. An agent working a task calls the model dozens or hundreds of times: planning, using a tool, reading the result, retrying. If a tool keeps failing, the agent can retry in a loop, and each loop re-sends a growing context.

Most provider dashboards report spend hours later, per API key. By then you know the total, not which agent or which job caused it.

Six controls that actually work

  • A budget per agent, not per company. One misbehaving agent should hit its own ceiling, not drain everyone's.
  • Checked before execution. The platform estimates the run and refuses to start work that would cross the limit. This is the control most tools skip.
  • A cap per run. A maximum number of steps or tokens for a single job, so a loop ends on its own.
  • Model routing. Use a fast, cheap model for routine steps and reserve frontier models for the hard reasoning.
  • Approval above a threshold. Any single job estimated above an amount you choose waits for a human yes.
  • A cost line on every audit entry. Spend attached to the agent, the job and the person who approved it.

Alerting versus enforcing

Spend alertsPre-execution budgets
When it actsAfter tokens are spentBefore the run starts
Stops a runaway loopNo, it tells you laterYes
GranularityUsually per API keyPer agent and per job
What you learnThe totalWhich agent, which job, who approved

Alerts are still worth having. They are just not a control.

How Nexus does it

In Nexus, every agent has a monthly budget that is checked in the execution path before a burst of work, approvals can be required for any action you choose, and every change lands in an audit trail with its cost. When you run Claude Code or Codex through Nexus, they sit under the same budgets. See pricing for the free plan and usage limits.

Frequently asked questions

How much does it cost to run an AI agent?

It ranges from fractions of a cent for a short task on a small model to several dollars for a long research or coding run on a frontier model. The spread comes from the number of model calls and how much context each call re-sends.

Can I set a hard spending limit on OpenAI or Anthropic API usage?

Providers offer account-level limits and alerts. They apply to the whole key or organization, not to an individual agent or job, which is why agent platforms add their own per-agent budgets.

What is the cheapest way to run agents?

Route most steps to a fast, low-cost model, keep context short by giving agents a searchable memory instead of pasting everything into every prompt, and cap steps per run.

Keep reading

Try Nexus free

Hand an agent one real job under a budget you set. The free plan never expires. Start on the web or see pricing.