Package org.machanism.machai.ai.manager
Class Usage
java.lang.Object
org.machanism.machai.ai.manager.Usage
Token usage metrics for a single generative-AI invocation.
Instances of this class are typically created by provider implementations and aggregated by
GenaiProviderManager to produce a summary log of the application's consumption.
This is an immutable value object.
-
Constructor Summary
ConstructorsConstructorDescriptionUsage(long inputTokens, long inputCachedTokens, long outputTokens) Creates a usage record. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the number of cached input tokens.longReturns the number of input tokens.longReturns the number of output tokens.
-
Constructor Details
-
Usage
public Usage(long inputTokens, long inputCachedTokens, long outputTokens) Creates a usage record.- Parameters:
inputTokens- number of input tokensinputCachedTokens- number of cached input tokens (provider-specific)outputTokens- number of output tokens
-
-
Method Details
-
getInputTokens
public long getInputTokens()Returns the number of input tokens.- Returns:
- input token count
-
getInputCachedTokens
public long getInputCachedTokens()Returns the number of cached input tokens.- Returns:
- cached input token count
-
getOutputTokens
public long getOutputTokens()Returns the number of output tokens.- Returns:
- output token count
-