Count Tokens
Counts prompt tokens for a Gemini model in Google AI Studio.
GET
Query
Arguments
stringrequired
Required. Model endpoint token including suffix, for example `gemini-2.5-flash:countTokens`.
array of object
Optional prompt contents to tokenize.
Uncommon arguments
object
Optional full GenerateContentRequest payload.
Field selectionChoose which fields should be included in the response. Learn more
string
Comma-separated response fields to include.