Gemini 4 Neon/Hydrogen: full-request countTokens input bound and billing

Could the Gemini Developer API team clarify the documented counting and billing behavior for gemini-4-neon and gemini-4-hydrogen on REST v1beta?

This is a general API-specification question. No live verification request has been submitted for this configuration.

Proposed request shape

  • Text only, a single user Content, native generationConfig.responseJsonSchema.
  • thinkingConfig.thinkingLevel: "MEDIUM", maxOutputTokens: 8000, intended single candidate (candidateCount: 1).
  • No tools, cached content, or prior model-turn history.

The troubleshooting guide lists candidate count as unsupported on Gemini 3/4. If the proposed candidateCount: 1 field is inadmissible, please identify the valid single-candidate form before assuming this configuration is supported.

Let C be one immutable logical GenerateContentRequest, including model, contents, and generationConfig. We propose:

  • Counting: POST /v1beta/models/{model}:countTokens, body {"generateContentRequest": C}.
  • Generation: POST /v1beta/models/{model}:generateContent, with the same model in the URL and a body equal to C with only model omitted. contents, native schema, and other generation settings remain identical.

1. Counting coverage and an input upper bound

Does countTokens.totalTokens for this complete request include every input component reported in usageMetadata.promptTokenCount, including native JSON schema and request framing/protocol tokens?

For these models, is there a documented guarantee of equality, or a finite upper-bound relationship:

promptTokenCount(C) <= totalTokens(C) + E(C, model, API)?

If so, please provide the documentation or written clarification stating the bound, the applicable model/API scope, and any exclusions. We need a pre-request input limit, not an observed average or safety factor. If no such guarantee is offered, please state that explicitly; we will keep the evaluation paused.

2. Applicability of unbilled token counting

Does the Billing FAQ’s unbilled GetTokens statement apply to the direct Developer API models/{model}:countTokens method for both named models, including the complete generateContentRequest form above? Please clarify the charge treatment of successful and rejected/failed counting requests and cite the applicable specification.

If the answer depends on a different supported request shape or product, please identify that scope rather than assuming equivalence. Please provide a public reference or a product-team clarification with an explicit scope. If project-specific diagnostics or live calls would be required, please first describe those prerequisites; no credentials or diagnostic attachments are included here.

References:

  • Counting tokens REST reference: https://aistudio.google.com/api-reference/tokens/count-tokens
  • GenerateContent REST reference: https://aistudio.google.com/api-reference/generate-content/generate-content
  • Billing FAQ: Is GetTokens billed?: https://aistudio.google.com/docs/billing#is-gettokens-billed
  • Troubleshooting: model parameters: https://aistudio.google.com/docs/troubleshooting#check-api

@eguchikun sounds like ur asking for a written guarantee, and i couldn’t find one. the scope matters here so heres what i did find.

google’s firebase ai logic docs say calling countTokens isnt charged and has a 3000 rpm max, Count tokens for Gemini models  |  Firebase AI Logic but thats a different product from the direct developer api method ur asking about, so it doesnt answer ur question 2 on its own. same for the billing faq line, which other people in the threads below are also asking whether it covers the direct rest method.

i didnt find anything documenting an upper bound between countTokens.totalTokens and usageMetadata.promptTokenCount for gemini-4-neon or hydrogen, or saying native json schema tokens are counted the same way in both. if its not in the rest reference ur already linking, id treat it as not guaranteed, which is also how ur paused evaluation reads it.

two other topics asking nearly the same billing question, worth following or adding ur scope to:

we cant give the written clarification u need, were volunteers and not google staff. best bet is the feedback link on the docs page, since a confirmed scope has to come from the api team.

Thank you. Two scope checks for the Neon/Hydrogen configuration in the original post:

  1. Is it correct that Google provides neither guaranteed equality nor a finite bound E between countTokens.totalTokens and usageMetadata.promptTokenCount for the complete request, including the native JSON schema and protocol overhead? If so, we will keep this evaluation paused.

  2. Does unbilled counting cover direct REST v1beta models/{model}:countTokens with the complete generateContentRequest, for both models, including successful, rejected, and failed counting requests?

Could you cite an official reference or obtain a product-team clarification with that explicit scope? Please mark any unconfirmed points as unconfirmed.