Clarification on Gemini API countTokens pricing, rate limits, and counting scope

I am using the free tier of the Gemini API.

I would like to clarify the following five points regarding the REST API’s models.countTokens:

  1. Does the statement in the official billing FAQ that “GetTokens API is not billed and does not count toward inference quotas” also apply to the REST API’s models.countTokens?

  2. Can models.countTokens be used for free under the Gemini API free tier?

  3. Do calls to models.countTokens affect the target model’s RPM (requests per minute), TPM (tokens per minute), or RPD (requests per day)?

  4. Are pricing and quota treated the same way for requests containing generateContentRequest?

  5. When generateContentRequest is used, does the returned totalTokens include systemInstruction and the JSON output schema specified in generationConfig.responseFormat.text.schema? If anything is excluded, please let me know.

The model I plan to use is gemini-3.6-flash. I have not set up a Google Cloud billing account.

Thank you in advance for your assistance.

Hello @pcsumaho_memo ,

Here are the details for each of your questions regarding models.countTokens:

  1. Billing FAQ and models.countTokens: Yes, the statement in the Billing FAQ applies to the REST API’s models.countTokens endpoint. Requests to models.countTokens are not billed and do not count against inference quota.
  2. Free tier availability: Yes, models.countTokens is free of charge on the Gemini API free tier and does not require a Google Cloud billing account (see Gemini Developer API pricing).
  3. Impact on model RPM, TPM, and RPD: Calls to models.countTokens do not count toward the target model’s inference rate limits (RPM, TPM, or RPD). Token counting has its own separate rate limit of up to 3,000 requests per minute per project (see Rate limits).
  4. Requests using generateContentRequest: Pricing and quota treatment are the same when passing a generateContentRequest object to models.countTokens—it does not run model inference, incurs no charge, and does not consume model RPM, TPM, or RPD quota (note that the nested generateContentRequest.model field must also be set, e.g., "models/gemini-3.6-flash"; see Counting tokens).
  5. What totalTokens includes and excludes: When calling models.countTokens with generateContentRequest, totalTokens includes contents, systemInstruction, tools (functionDeclarations), and cachedContent. It does not include JSON output schemas passed inside generationConfig (such as responseFormat.text.schema, responseSchema, or responseJsonSchema), other generationConfig settings, or output and thinking tokens (candidatesTokenCount and thoughtsTokenCount, which are only produced during inference and reported in usageMetadata; see Understand and count tokens).