[BUG] <title>OpenRouter Gemma 4 appears to fall back to GPT-3.5 tokenizer

Author: kawaii-tanukiCreated Sep 13, 2026Updated Sep 13, 2026
Labels🐛 Bug

Environment

Windows

System

Windows 11, Firefox 155

Version

1.18.0

Desktop Information

Generation API: OpenRouter Model: Gemma 4

Describe the problem

When using Gemma 4 through OpenRouter, SillyTavern's token count seems to be using the GPT-3.5 tokenizer instead of the Gemma tokenizer.

I noticed the token count looked unusual and checked the current tokenizer selection code.

OpenRouter currently reports Gemma 4 models with:

architecture.tokenizer = "Gemma"

However, SillyTavern appears to select the Gemma tokenizer only when the value is:

architecture.tokenizer === "Gemini"

So "Gemma" does not seem to match that condition and appears to fall through to the default gpt-3.5-turbo tokenizer.

Additional info

No response

Please tick the boxes

  • I have explained the issue clearly, and I included all relevant info
  • I have checked that this issue hasn't already been raised
  • I have checked the docs important
  • I confirm that my issue is not related to third-party content, unofficial extension or patch. If in doubt, check with a new user account and with extensions disabled