Class Usage

java.lang.Object
org.machanism.machai.ai.manager.Usage

public class Usage extends Object
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 Details

    • Usage

      public Usage(long inputTokens, long inputCachedTokens, long outputTokens)
      Creates a usage record.
      Parameters:
      inputTokens - number of input tokens
      inputCachedTokens - 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