Guide

How to Track AI Token Spend

A practical measurement plan for LLM token usage by model, workflow, user, agent, cost, and accepted output.

Updated 2026-05-12ai-spend / finops / cost-control
Desk note

Spend tracking fails when it starts at the invoice. The useful unit is the traced model call with enough metadata to explain who triggered it, why it ran, what it cost, and whether the result survived review.

Start with attribution

Every request should carry metadata that identifies the product surface, workflow, model, user or agent, prompt version, and environment. Without attribution, the only thing a cost dashboard can say is that money was spent somewhere.

  • Minimum tags: workflow, owner, model, prompt version, environment.
  • Useful extras: customer tier, feature flag, route, and task category.

ReceiptsRamp Economics Lab

On this siteAI FinOps topic hub

Record the cost inputs

Track input tokens, output tokens, cached tokens where available, retries, tool calls, latency, and model price at the time of the request. Preserve the pricing source or snapshot date so future readers understand the calculation.

  • Separate input and output tokens because pricing usually differs.
  • Keep retry count and tool-call count visible.

Attach outcome state

Token data becomes operational when paired with whether the output was accepted, edited, rejected, or escalated. That one field separates cost accounting from productivity theater.

  • Accepted output makes cost-per-task possible.
  • Edited or rejected output exposes prompts and routes that need repair.

Build outlier views

The first useful dashboards are not elaborate executive scoreboards. They are outlier views: highest-cost workflows, sudden jumps, high retry rates, expensive agents, and low-acceptance prompts.

  • Sort by total spend and by cost per accepted result.
  • Review the trace before changing the model or prompt.
Weekly briefing

The term is moving faster than the definition.

Tokenmaxxing keeps shifting as new receipts land. The weekly briefing tracks who's burning what, and why it matters.

Written by the desk's AI, human-reviewed before send, real numbers only.

Source trail

Current feed records connected to this guide

DevOps.com source artwork
long-formD
long-form

What You Cannot See Will Break Your LLM App: A Practitioner Guide to Production Observability

Gourav Singla details what an LLM app needs instrumented when it returns HTTP 200 and still fails: per-workflow token logging, finish-reason tracking, and tiered alerts that catch cost anomalies before the invoice explains them.

tokenmaxxingllm-observabilitycost-governance
Read note
PYMNTS.com source artwork
newsP
news

AI Agents Just Got Their Own Company Credit Cards

Mercury launched Agent Cards through Mercury Spend: virtual cards an AI agent spends from inside company-set rules, with transactions outside them declined automatically and no way for the agent to raise its own limit.

tokenmaxxingagentsai-spend
Read note
InfoWorld source artwork
long-formI
long-form

The strangest developer productivity metric of all time

Matthew Tyson argues token burn is a worse productivity measure than lines of code, pointing at Meta's Claudeonomics leaderboard, which ranked the top 250 of over 85,000 employees and drove 60.2 trillion tokens in 30 days.

tokenmaxxingmetricsscoreboards
Read note
Project layer

Tools that make the guide operational

#1Direct
Routing

LiteLLM

BerriAI/litellm

An OpenAI-compatible gateway and SDK for calling many model providers with budgets, logging, load balancing, guardrails, and cost tracking.

56.5K10.7KSource-available
gatewaycost-trackingrouting
#2Direct
Observability

Langfuse

langfuse/langfuse

Open-source LLM engineering platform for observability, traces, metrics, evals, prompt management, datasets, and playground workflows.

33.2K3.6KSource-available
tracesevalscosts
#5Direct
Evaluation

promptfoo

promptfoo/promptfoo

A CLI and CI workflow for testing prompts, agents, and RAG systems across models, with evals and red-team style checks.

24.3K2.2KMIT
prompt-evalscirag
Briefing

Fresh source notes each week.

New tokenmaxxing links, model-router signals, agent usage research, and AI cost notes.