Aggregates token and cost statistics across all models used in an agent run.
The top-level fields (requestCount, inputTokens, etc.) are roll-ups across every model. The byModel map breaks the same figures down per model name (e.g. "claude-sonnet-4-5-latest", "gpt-4o"), allowing cost attribution per provider in multi-model pipelines.
totalCost uses BigDecimal rather than Double to keep cumulative sums deterministic regardless of the number of requests.
Value parameters
- byModel
-
per-model breakdown; keyed by the model identifier string
- inputTokens
-
total prompt tokens sent across all models
- outputTokens
-
total completion tokens received across all models
- requestCount
-
total API calls across all models
- thinkingTokens
-
total extended-thinking tokens (non-zero only for Anthropic models)
- totalCost
-
total estimated cost in USD;
BigDecimal(0)when unavailable
Attributes
- See also
-
ModelUsage for the per-model record type
org.llm4s.agent.AgentState which carries a UsageSummary for the whole run
- Companion
- object
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass Any