Firebase.AI.CountTokensResponse

The model's response to a count tokens request.

Summary

Properties

PromptTokensDetails
IReadOnlyList<ModalityTokenCount >
The breakdown, by modality, of how many tokens are consumed by the prompt.
TotalBillableCharacters
int
Deprecated.Use TotalTokens instead; Gemini 2.0 series models and newer are always billed by token count.
The total number of billable characters in the text input given to the model as a prompt.
TotalTokens
int
The total number of tokens in the input given to the model as a prompt.

Properties

PromptTokensDetails

IReadOnlyList<ModalityTokenCount>Firebase::AI::CountTokensResponse::PromptTokensDetails

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

TotalBillableCharacters

intFirebase::AI::CountTokensResponse::TotalBillableCharacters

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

Important: This does not include billable image, video or other non-text input. SeeFirebase AI pricing for details.

Use TotalTokens instead; Gemini 2.0 series models and newer are always billed by token count.

Deprecated.Use TotalTokens instead; Gemini 2.0 series models and newer are always billed by token count.

TotalTokens

intFirebase::AI::CountTokensResponse::TotalTokens

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

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-24 UTC.