Class GenerateContentResponseUsageMetadata

java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.GenerateContentResponseUsageMetadata

public abstract class GenerateContentResponseUsageMetadata extends JsonSerializable
Usage metadata about response(s).
  • Constructor Details

    • GenerateContentResponseUsageMetadata

      public GenerateContentResponseUsageMetadata()
  • Method Details

    • cacheTokensDetails

      public abstract Optional<List<ModalityTokenCount>> cacheTokensDetails()
      Output only. List of modalities of the cached content in the request input.
    • cachedContentTokenCount

      public abstract Optional<Integer> cachedContentTokenCount()
      Output only. Number of tokens in the cached part in the input (the cached content).
    • candidatesTokenCount

      public abstract Optional<Integer> candidatesTokenCount()
      Number of tokens in the response(s).
    • candidatesTokensDetails

      public abstract Optional<List<ModalityTokenCount>> candidatesTokensDetails()
      Output only. List of modalities that were returned in the response.
    • promptTokenCount

      public abstract Optional<Integer> promptTokenCount()
      Number of tokens in the request. When `cached_content` is set, this is still the total effective prompt size meaning this includes the number of tokens in the cached content.
    • promptTokensDetails

      public abstract Optional<List<ModalityTokenCount>> promptTokensDetails()
      Output only. List of modalities that were processed in the request input.
    • thoughtsTokenCount

      public abstract Optional<Integer> thoughtsTokenCount()
      Output only. Number of tokens present in thoughts output.
    • toolUsePromptTokenCount

      public abstract Optional<Integer> toolUsePromptTokenCount()
      Output only. Number of tokens present in tool-use prompt(s).
    • toolUsePromptTokensDetails

      public abstract Optional<List<ModalityTokenCount>> toolUsePromptTokensDetails()
      Output only. List of modalities that were processed for tool-use request inputs.
    • totalTokenCount

      public abstract Optional<Integer> totalTokenCount()
      Total token count for prompt, response candidates, and tool-use prompts (if present).
    • trafficType

      public abstract Optional<TrafficType> trafficType()
      Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota.
    • builder

      Instantiates a builder for GenerateContentResponseUsageMetadata.
    • toBuilder

      public abstract GenerateContentResponseUsageMetadata.Builder toBuilder()
      Creates a builder with the same values as this instance.
    • fromJson

      public static GenerateContentResponseUsageMetadata fromJson(String jsonString)
      Deserializes a JSON string to a GenerateContentResponseUsageMetadata object.