CountTokensResponse

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 constructors

CountTokensResponse(
    totalTokens: Int,
    totalBillableCharacters: Int?,
    promptTokensDetails: List<ModalityTokenCount>
)

Public functions

operator Int
operator Int?
operator List<ModalityTokenCount>?

Public properties

List<ModalityTokenCount>

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

Int?

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

Int

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

Public constructors

CountTokensResponse

CountTokensResponse(
    totalTokens: Int,
    totalBillableCharacters: Int? = null,
    promptTokensDetails: List<ModalityTokenCount> = emptyList()
)

Public functions

component1

operator fun component1(): Int

component2

operator fun component2(): Int?

component3

operator fun component3(): List<ModalityTokenCount>?

Public properties

promptTokensDetails

val promptTokensDetailsList<ModalityTokenCount>

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

totalBillableCharacters

val totalBillableCharactersInt?

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

val totalTokensInt

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