CountTokensResponse

public final class CountTokensResponse


The model's response to a count tokens request.

Important: The counters in this class do not include billable image, video or other non-text input. See Vertex AI pricing for details.

Summary

Public fields

final @NonNull List<@NonNull ModalityTokenCount>

The breakdown, by modality, of how many tokens are consumed by the prompt.

final Integer

The total number of billable characters in the text input given to the model as a prompt.

final int

The total number of tokens in the input given to the model as a prompt.

Public constructors

CountTokensResponse(
    int totalTokens,
    Integer totalBillableCharacters,
    @NonNull List<@NonNull ModalityTokenCount> promptTokensDetails
)

Public methods

final int
final Integer
final List<@NonNull ModalityTokenCount>

Public fields

promptTokensDetails

public final @NonNull List<@NonNull ModalityTokenCountpromptTokensDetails

The breakdown, by modality, of how many tokens are consumed by the prompt.

totalBillableCharacters

public final Integer totalBillableCharacters

The total number of billable characters in the text input given to the model as a prompt. Important: this property does not include billable image, video or other non-text input. See Vertex AI pricing for details.

totalTokens

public final int totalTokens

The total number of tokens in the input given to the model as a prompt.

Public constructors

CountTokensResponse

public CountTokensResponse(
    int totalTokens,
    Integer totalBillableCharacters,
    @NonNull List<@NonNull ModalityTokenCount> promptTokensDetails
)

Public methods

component1

public final int component1()

component2

public final Integer component2()

component3

public final List<@NonNull ModalityTokenCountcomponent3()