google.generativeai.count_message_tokens

Calls the API to calculate the number of tokens used in the prompt.