java.lang.Object
com.google.genai.gaos.models.interactions.Usage

public class Usage extends Object
Usage

Statistics on the interaction request's token usage.

  • Constructor Details

  • Method Details

    • cachedTokensByModality

      public Optional<List<ModalityTokens>> cachedTokensByModality()
      A breakdown of cached token usage by modality.
    • groundingToolCount

      public Optional<List<GroundingToolCount>> groundingToolCount()
      Grounding tool count.
    • inputTokensByModality

      public Optional<List<ModalityTokens>> inputTokensByModality()
      A breakdown of input token usage by modality.
    • outputTokensByModality

      public Optional<List<ModalityTokens>> outputTokensByModality()
      A breakdown of output token usage by modality.
    • toolUseTokensByModality

      public Optional<List<ModalityTokens>> toolUseTokensByModality()
      A breakdown of tool-use token usage by modality.
    • totalCachedTokens

      public Optional<Integer> totalCachedTokens()
      Number of tokens in the cached part of the prompt (the cached content).
    • totalInputTokens

      public Optional<Integer> totalInputTokens()
      Number of tokens in the prompt (context).
    • totalOutputTokens

      public Optional<Integer> totalOutputTokens()
      Total number of tokens across all the generated responses.
    • totalThoughtTokens

      public Optional<Integer> totalThoughtTokens()
      Number of tokens of thoughts for thinking models.
    • totalTokens

      public Optional<Integer> totalTokens()
      Total token count for the interaction request (prompt + responses + other internal tokens).
    • totalToolUseTokens

      public Optional<Integer> totalToolUseTokens()
      Number of tokens present in tool-use prompt(s).
    • builder

      public static Usage.Builder builder()
    • withCachedTokensByModality

      public Usage withCachedTokensByModality(@Nullable List<ModalityTokens> cachedTokensByModality)
      A breakdown of cached token usage by modality.
    • withGroundingToolCount

      public Usage withGroundingToolCount(@Nullable List<GroundingToolCount> groundingToolCount)
      Grounding tool count.
    • withInputTokensByModality

      public Usage withInputTokensByModality(@Nullable List<ModalityTokens> inputTokensByModality)
      A breakdown of input token usage by modality.
    • withOutputTokensByModality

      public Usage withOutputTokensByModality(@Nullable List<ModalityTokens> outputTokensByModality)
      A breakdown of output token usage by modality.
    • withToolUseTokensByModality

      public Usage withToolUseTokensByModality(@Nullable List<ModalityTokens> toolUseTokensByModality)
      A breakdown of tool-use token usage by modality.
    • withTotalCachedTokens

      public Usage withTotalCachedTokens(@Nullable Integer totalCachedTokens)
      Number of tokens in the cached part of the prompt (the cached content).
    • withTotalInputTokens

      public Usage withTotalInputTokens(@Nullable Integer totalInputTokens)
      Number of tokens in the prompt (context).
    • withTotalOutputTokens

      public Usage withTotalOutputTokens(@Nullable Integer totalOutputTokens)
      Total number of tokens across all the generated responses.
    • withTotalThoughtTokens

      public Usage withTotalThoughtTokens(@Nullable Integer totalThoughtTokens)
      Number of tokens of thoughts for thinking models.
    • withTotalTokens

      public Usage withTotalTokens(@Nullable Integer totalTokens)
      Total token count for the interaction request (prompt + responses + other internal tokens).
    • withTotalToolUseTokens

      public Usage withTotalToolUseTokens(@Nullable Integer totalToolUseTokens)
      Number of tokens present in tool-use prompt(s).
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object