Guide 32 of 61 · Cost
See what each task cost
Route an agent's model calls through AgentGarm so each one is counted and priced, and read the spend by provider and model.
Steps marked preview rely on a package that has not passed its release gate.
Route an agent's model calls through AgentGarm so each one is counted and priced, read the Spend screen by provider and model, understand how reasoning and cache tokens are counted and priced, check which catalog the prices come from, and, where the dashboard shows them (in preview), see spend per currency and hour and what one run cost.
1. Send the agent's calls through the proxy
Only calls that pass through agentgarm-session's proxy are counted, so start the agent with agentgarm run. The proxy records each call with its provider, model, tokens by class, the service tier and the status, and agentgarm-session prices it from the catalog. When a successful call's response reports no usage, the tokens are estimated from the request and the streamed output, and the call is marked as an estimate; a response the proxy cannot decode is left unpriced. With agentgarm run, Claude Code sends its task id with each call, so the call is attributed to its task; a call from an agent that sends none, such as Codex, is attributed to the task of the process that made it. Subscription traffic is never proxied, so only API-key and gateway-key calls appear here.
agentgarm run -- claudeChecked by the walk: this command ran as written on a no-root Linux install.
See also
Set spend budgets and stop runaway loopsGive each agent task a cost budget and a token rate, see what the agent meets at the cap, and stop loops and runaway subagents with limits of their own.
2. Open the Spend screen
agentgarm ui prints the dashboard's address, and --open opens it. The Spend screen's title gives how many of your recent model calls were priced and their total (“Last N priced model calls”), a chart shows their cost per hour, and its table lists them by provider and model, with the number of calls, the tokens and the cost of each; calls the catalog cannot price are listed apart, under “Unpriced (not in the catalog)”. The Tokens column adds up uncached input, output and cache reads; cache writes are priced but not counted there. The figures are for your own calls, as agentgarmd records them.
agentgarm ui --openagentgarm uiChecked by the walk: this command ran as written on a no-root Linux install.
3. Read reasoning and cache tokens
Output tokens include reasoning, as providers bill them; when a provider also reports its reasoning or thinking tokens separately, that count is kept for information and never priced twice. Input is counted uncached: cache reads and cache writes have classes of their own, cache writes split by their cache lifetime (5 minutes or 1 hour), and each class is priced at its own catalog rate. A class with tokens but no rate in the catalog, such as another cache lifetime, makes the cost partial, and the unpriced classes are named.
4. Check where the prices come from
Prices and model names live only in the versioned catalog built into AgentGarm, never in code. Each curated provider's prices are checked against the vendor's pricing page on the date the file records. OpenRouter's are generated from its published model list, and a few smaller providers carry seed input and output rates only, with no verified date; a build-time pull from a model resolver that is to replace both is built but not yet in use. A price change is a new revision with the date it takes effect, so an earlier call keeps the price it was made at. A model is matched by its exact id or an alias, or with a dated snapshot suffix removed; a model the catalog does not know is left unpriced, never guessed. agentgarm status prints the catalog version on its catalog line, labelled as the CLI's built-in copy.
agentgarm statusChecked by the walk: this command ran as written on a no-root Linux install.
5. See spend per currency and per hour
previewThe Spend screen's Recent calls tab keeps each currency apart and never adds amounts in different currencies: the currency most calls were priced in gets an hourly chart from its first call's hour to its latest within the last 24 hours, and the others are listed beside it. Each model row shows its share of the spend and its catalog price per million tokens for reference, while the costs stay as each call was priced. A call the catalog could not price is in no total; it is listed apart as unpriced.
6. See what one run cost
previewThe dashboard's Runs screen lists your runs, newest first, with each run's cost per currency and its unpriced calls counted apart. Open a run for its cost and number of model calls, its timeline with the model calls in their own lane and each one's price in its Cost column, and its costliest model calls beside it. Spend's By period tab gives spend over a period, such as this month, compared with the one before. The list of runs and a run's timeline export to CSV.
See also
Trace what one agent task didFind an agent's task in the dashboard, read every decision its policy made with the rule behind it, and follow the run from first decision to last.