LLM MeasurementGitHub
Guides

Which agent drove your LLM spend increase?

Compare recorded agent spend in LiteLLM logs or Langfuse exports to find who contributed to an increase.

Choose an identity

Use --agent-source agent_id for LiteLLM's recorded IDs instead of tags. For native database access, use the read-only LiteLLM connection with the same agent options.

Request-tag database reads also need the separate request_tags column grant in the released setup. It is not part of default access.

Langfuse exports support tag identities with the same prefix options. Identities remain project-scoped.

Aliases are the default. Add both --show-labels --acknowledge-sensitive-labels only for a private report with escaped labels.

Security

Keep exports private: tags can contain identifiers. Analysis reads local records without provider calls. Missing and conflicting identities remain visible, not guessed.

Try the sample

This synthetic fixture includes two agents, an untagged request and conflicting tags.

set -eu
umask 077
curl -fsSLo install-fleetdiff.sh https://raw.githubusercontent.com/llm-measurement/fleetdiff/45f8d7aef43a88e1c24033a9f80c4a667f8dbad7/scripts/install.sh
sh install-fleetdiff.sh v0.14.1 ./bin
curl -fsSLo spend.csv https://raw.githubusercontent.com/llm-measurement/fleetdiff/45f8d7aef43a88e1c24033a9f80c4a667f8dbad7/examples/litellm-spend/agent-tags.csv
printf '%s  %s\n' 'aed879a4b423f850f221f9d934f42b52f7d0f293906275488017cbb6c277d5f4' spend.csv | shasum -a 256 -c -
./bin/fleetdiff investigate --litellm-spend spend.csv \
  --before-period 2026-10-07 --after-period 2026-10-08 \
  --group-by agent --agent-source request-tag --agent-tag-prefix 'agent:' \
  --rank-by recorded-spend-change

What you'll see

These excerpts come from the released binary. The answer measures token contribution; the contributor table is ranked by signed recorded-USD change.

Recorded tokens rose by 106.67% (300 -> 620).
Who drove the increase?
  agent-1 accounts for 62.5% of the net recorded increase (+200 of +320 tokens).

The later period includes 50 unknown and 70 ambiguous tokens. Both stay in the 620-token total. Known agents account for 500 tokens, not all recorded work.

What the numbers mean

Recorded spend is source accounting, not an invoice. Missing and ambiguous identities stay in the totals; attribution does not establish why usage changed.
Measurement notes

  • Agent tags are supplied by your application. One matching nonempty tag identifies an agent; multiple distinct matching tags are ambiguous.
  • Recorded-spend ranking uses signed changes, not absolute movement. Missing costs remain missing, never zero.
  • Langfuse agents with identical labels in different projects remain separate. Neither source establishes a causal explanation or cross-provider identity.

evijay+fleetdiff@gmail.com · Questions · Ran it on your data? Tell us what it found · Security issues (private)