Count Token Differences between Vertex AI and Google AI Studio (When contents is multilingual)

I noticed a discrepancy in token count when using the same multilingual prompt with the Gemini 2.5 Flash model in Vertex AI vs. Google AI Studio.

Using the count_tokens() method:

  • In Vertex AI, the total token count was 121.
  • In Google AI Studio, the token count was 101 for the same prompt.

This prompt is in Korean and contains bullet points with varying sentence lengths.

Vertex AI

from google import genai

client = genai.Client(vertexai=True, project="MYPROJECT_HERE", location='global')

prompt = """다음은 UI 구성 요소에 자주 사용되는 텍스트 항목입니다:

- 짧은 텍스트
- 약간 긴 문장 형태의 텍스트 항목입니다.
- 매우 길고 복잡한 내용을 포함하는 항목으로, 여러 줄에 걸쳐 표시될 수 있습니다. 화면 크기에 따라 줄바꿈이 발생할 수 있으므로 주의가 필요합니다.

이러한 다양한 유형의 텍스트를 통해 실제 사용 환경과 유사한 테스트가 가능합니다."""

response = client.models.count_tokens(
    model='gemini-2.5-flash',
    contents=prompt
)
print(response)
total_tokens=121 cached_content_token_count=None

Google AI Studio

import google.generativeai as genai
from google.colab import userdata

genai.configure(api_key=userdata.get("GOOGLE_API_KEY"))

model = genai.GenerativeModel("gemini-2.5-flash")

prompt = """다음은 UI 구성 요소에 자주 사용되는 텍스트 항목입니다:

- 짧은 텍스트
- 약간 긴 문장 형태의 텍스트 항목입니다.
- 매우 길고 복잡한 내용을 포함하는 항목으로, 여러 줄에 걸쳐 표시될 수 있습니다. 화면 크기에 따라 줄바꿈이 발생할 수 있으므로 주의가 필요합니다.

이러한 다양한 유형의 텍스트를 통해 실제 사용 환경과 유사한 테스트가 가능합니다."""

response = model.count_tokens(prompt)

print(response)
total_tokens: 101

Question

  1. What causes the difference in token counts between Vertex AI and Google AI Studio when using the same model and prompt?
  2. Is token-based pricing calculated based on the actual number of tokens counted by each platform respectively, or is there a unified pricing scheme regardless of where the call originates?

Hi @jiwunghyun,

Thanks for reporting this issue.. I will escalate this issue to the concerned team and have them look into it..

Is there any update for this issue?