org.llm4s.agent.ModelUsage
See theModelUsage companion object
case class ModelUsage(requestCount: Long, inputTokens: Long, outputTokens: Long, thinkingTokens: Long, totalCost: BigDecimal)
Accumulates token and cost statistics for a single model across one or more requests.
totalCost is stored as BigDecimal to avoid floating-point accumulation drift that would occur when summing many Double values; incoming Option[Double] costs are converted once via BigDecimal.decimal on first contact.
Value parameters
- inputTokens
-
cumulative prompt tokens sent to the model
- outputTokens
-
cumulative completion tokens received from the model
- requestCount
-
number of API calls attributed to this model
- thinkingTokens
-
cumulative extended-thinking tokens (Anthropic only; zero for other providers)
- totalCost
-
cumulative estimated cost in USD;
BigDecimal(0)when cost data is unavailable
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass Any
Members list
In this article