Gemini Developer API: countTokens returns 404 although models.get and models.list succeed

We use Google GenAI Developer API v1beta with locked Python SDK google-genai 2.14.0. The same local API credential was used for metadata and CountTokens requests. No API key, authorization header, customer data, prompt, or raw request/response is included.

Successful metadata calls (one HTTP attempt each):

  • GET /v1beta/models/gemini-2.5-pro returned HTTP 200 at 2026-10-17T17:41:18.612736Z; resource models/gemini-2.5-pro, version 2.5.
    • GET /v1beta/models/gemini-2.5-flash returned HTTP 200 at 2026-10-17T17:42:42.554143Z; resource models/gemini-2.5-flash, version 001.
      • Both models.get responses listed generateContent, countTokens, createCachedContent, and batchGenerateContent.
        • A separate GET /v1beta/models?pageSize=1000 returned HTTP 200 in one attempt and listed models/gemini-2.5-flash with countTokens among its supported methods. The retained safe evidence has no request timestamp for this call.
      • CountTokens failures (one HTTP attempt each; no generation):
        1. The application CountTokens call carrying its full generateContentRequest wrapper used POST /v1beta/models/gemini-2.5-flash:countTokens and returned HTTP 404 NOT_FOUND at 2026-10-17T17:10:56.963996Z. Run ID 61f5422656ae43bf8cec7f3a14a87374; safe evidence SHA-256 dd371bea42a3bc2595377c9c71f14293af8a988399713dee8df6be3e301674dd.
          1. The SDK’s simple count_tokens(model=gemini-2.5-flash, contents=…) call used the same POST route and returned HTTP 404 NOT_FOUND at 2026-10-17T18:01:37.152623Z. Run ID 3aa2b92bb92a4472a1fa77656aa279a6; safe evidence SHA-256 baf4182d5f14acd0ff9c9e9ca0681858fdeadac34ce9aa11e1cc8b990c561449.
        2. The offline comparison found no request-contract mismatch. Live safe logs do not retain raw bodies. None of the retained safe evidence contains a provider request ID. The 404 cause remains unknown; we are not inferring model access or project eligibility from status alone.
      • Could you advise why model metadata advertises countTokens while both request forms return 404, and what non-secret correlation information or checks would help identify the server-side cause? We can provide the API project identifier through a private support channel if needed; we will not post it publicly.