google.generativeai.count_text_tokens

Calls the API to count the number of tokens in the text prompt.