MOJI

How to cap what Claude Code and Codex agents spend

A spending cap for Claude Code and Codex agents should cover the whole job, be priced before it starts and stop new work once it is spent.

Claude Code and Codex now hand work to several agents at once, and every extra agent adds to the bill. Anthropic reported that its own multi-agent research system used about 15 times the tokens of a chat. A team that runs coding agents every day needs a spending limit it can trust before the work starts.

Set the budget on the whole job

A coding job has many steps, such as plan, build, test, review and ship. Each step calls a model, and a step runs again when its check fails. A useful cap covers the whole job, retries included.

Price each step before the work starts

Moji prices each step from what earlier jobs cost, and adds the step prices into one budget for the job. A person on the team commits that budget before the swarm runs. The team can see the price of a job before it spends anything.

Count usage while the swarm runs

Moji counts each step’s reported usage against the budget while the work moves. Claude Code reports the cost of each step, and Codex reports its tokens. Moji checks the budget each time it hands out work, and once the budget is spent, Moji starts no new work.

Check each step so the team pays once

Wrong work that flows on to the next step is the most expensive kind, because every later step has to be redone. Moji checks each step as it completes, with a test, a second agent or a person. Moji sends only the failed step back, and the rest of the job keeps its finished work.

Keep your own accounts

Your agents call Anthropic and OpenAI under your own logins, so the model bill stays on your own accounts. Moji stores no model keys.

To see how this works across a whole swarm, read how Moji works, or request access.

More from the blog