Gemini-2.5-flash-lite countTokens returns 404, while models.get and another model’s countTokens succeed

Hello,

I am investigating a model-specific countTokens failure in a Gemini API project whose Free tier was confirmed in Google AI Studio before testing.

Environment:

  • Direct REST API, v1beta
  • Windows / Node.js
  • The same API key and project were used for all comparisons.

Observed results:

  1. models.get for gemini-2.5-flash-lite returned HTTP 200 and advertised countTokens among its supported methods.
  2. gemini-2.5-flash-lite countTokens with minimal top-level contents returned HTTP 404, with error status NOT_FOUND.
  3. The same model’s countTokens using generateContentRequest, without a system instruction, also returned HTTP 404 / NOT_FOUND.
  4. As a control, gemini-3.1-flash-lite countTokens with the same minimal contents returned HTTP 200 and totalTokens: 3.

The minimal user text was “안녕하세요.” The three countTokens comparisons occurred on October 10, 2026, between 11:54:23 and 11:54:24 UTC.

No generateContent, streaming, or image generation requests were made during these diagnostics. No billing settings or application model mappings were changed.

Could you please clarify:

  • Whether legacy Gemini 2.5 eligibility or model-specific access restrictions can cause this result.
  • Whether this is specifically a Free-tier restriction, an API routing issue, or a service issue.
  • Whether countTokens for this exact model requires a different documented API version or request structure.
  • Whether access can be restored while preserving the Free tier and the existing model mapping.

I can provide the project ID through an appropriate non-public Google support channel if needed. This post intentionally excludes API keys, authentication headers, and private conversation data.

Thank you.

Hello @CHOIJEONGIK,

  • Legacy Gemini 2.5 eligibility: Access to gemini-2.5-flash-lite is limited to projects that have previously used the model (see the Gemini 2.5 Flash-Lite documentation). While models.get returns general model metadata (HTTP 200), runtime calls (countTokens and generateContent) check whether the project has prior usage of gemini-2.5-flash-lite and return HTTP 404 (NOT_FOUND) if it does not, regardless of Free vs. Paid tier.
  • Recommended fix: Update your model ID to a current model such as gemini-3.5-flash-lite, gemini-3.1-flash-lite, or gemini-3.8-flash (see Gemini models).