Repository: SillyTavern/SillyTavern (language: javascript)

Issue:
[BUG] Some serious cleanup is needed in Gemini API models list
### Environment

🐧 Linux

### System

Ubuntu LTS, Google Chrome

### Version

1.12.13

### Desktop Information

_No response_

### Describe the problem

Hello,

Since the new Gemini models have just been released, i think ST needs to remove duplicate/deprecated models in the list, which already includes old and unusable models, only to focus on the latest Gemini models:

google/gemini-2.5-pro-preview-03-25
google/gemini-2.5-flash-preview
google/gemini-2.5-flash-preview:thinking

With that being said, the need for the cleanup is necessary to make a more organized sorting and a focus on the latest models at the same time, thus enhancing the user experience in ST overall.

### Additional info

_No response_

### Please tick the boxes

- [x] I have explained the issue clearly, and I included all relevant info
- [x] I have checked that this [issue hasn't already been raised](https://github.com/SillyTavern/SillyTavern/issues?q=is%3Aissue)
- [x] I have checked the [docs](https://docs.sillytavern.app/) ![important](https://img.shields.io/badge/Important!-F6094E)
- [x] 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](https://docs.sillytavern.app/administration/multi-user/) and with extensions disabled


Discussion / hints:
There's 16 models that can be removed.
```
gemini-1.5-flash-latest does not return a specific "modelVersion" value however not likely to receive another update

gemini-2.0-flash-thinking-exp-1219 returns gemini-2.0-flash-thinking-exp-01-21
gemini-1.5-pro-latest returns gemini-1.5-pro-002 (not likely to receive another update)
gemini-1.5-pro   also returns gemini-1.5-pro-002
gemini-1.5-flash-8b-exp-0924 returns gemini-1.5-flash-8b-exp-0827 (yes it went backward)
gemini-1.5-flash-8b-latest returns gemini-1.5-flash-8b-001 (not likely to receive another update)

404 NOT_FOUND for API version v1beta or is not supported for generateContent
gemini-exp-1114
gemini-1.5-pro-exp-0827
gemini-1.5-pro-exp-0801
gemini-1.5-flash-exp-0827
gemini-1.0-pro
gemini-1.0-pro-latest
gemini-1.0-pro-001
gemini-pro
gemini-ultra
gemini-1.0-ultra-latest
```

---

On 2025-04-22, I ran [`models.list`](https://ai.google.dev/api/models#method:-models.list) and discovered the following:

Both <ins>`gemini-1.5-flash-8b-exp-0827`</ins> and `0924` mention `Replaced by Gemini-1.5-flash-8b-001 (stable)` in their description. I'm not entirely sure if both are aliased to 001.

Both <ins>`gemini-2.0-flash-thinking-exp-1219`</ins> and <ins>`01-21`</ins> are now aliased to `gemini-2.5-flash-preview-04-17` according to both `models.list` and `models.generateContent`.

While generateContent returns modelVersion of 01-21 for <ins>`gemini-2.0-flash-thinking-exp`</ins>, `models.list` also ties it to 2.5-flash-preview-04-17 like above.

<ins>`gemini-exp-1206`</ins>: list shows 2.5-exp-03-25 in version and description. generateContent shows me RESOURCE_EXHAUSTED quotaValue of 25 (matches 25 RPD of 2.5 Pro and the fact 2.5 Pro returns gemini-2.0-pro-exp as "model" value).

<ins>`gemini-2.0-pro-exp`</ins>: List shows the same thing and it took a long time to think when I got one request in.
<ins>`gemini-2.0-pro-exp-02-05`</ins>: List shows same thing.

<ins>`gemini-exp-1121`</ins> 404 NOT_FOUND

So this is 8 more models underlined above to remove.
It's better to get the list in realtime from google once connected to the API (if possible)
Writing the list manually is hard to catch up the latest models
> It's better to get the list in realtime from google once connected to the API (if possible)

You'd think we'd do that, right? Issue is [`models.list`](https://ai.google.dev/api/models#method:-models.list) is filled with bs.

---

I would urge to scrap display names. We aren't doing display names for most endpoints, and there aren't any issues with these. In fact, I find it cleaner to have only code names so we know exactly what we're trying to connect to. OpenRouter is slightly different as we can see the code name in the terminal.

---

We should have main groups similar to what appears in AI Studio. Here, the relevant Gemini models should be put under a single Gemini group.

| "Gemini" group | Display name | Context size | Max output |
| - | - | -: | -: |
| gemini-2.5-pro-preview-03-25 | Gemini 2.5 Pro Preview 03-25 (Paid) | 1,048,576 | 65,536 |
| gemini-2.5-pro-exp-03-25 | Gemini 2.5 Pro Exp 03-25 | 1,048,576 | 65,536 |
| gemini-2.5-flash-preview-04-17 | Gemini 2.5 Flash Preview 04-17 | 1,048,576 | 65,536 |
| gemini-2.0-flash-001 | Gemini 2.0 Flash 001 | 1,048,576 | 8,192 |
| gemini-2.0-flash-exp-image-generation | Gemini 2.0 Flash (Image Generation) Experimental | 1,048,576 | 8,192 |
| gemini-2.0-flash-lite-001 | Gemini 2.0 Flash-Lite 001 | 1,048,576 | 8,192 |
| gemini-1.5-pro-002 | Gemini 1.5 Pro 002 | 2,000,000 | 8,192 |
| gemini-1.5-flash-001 | Gemini 1.5 Flash 001 | 1,000,000 | 8,192 |
| gemini-1.5-flash-8b-001 | Gemini 1.5 Flash-8B 001 | 1,000,000 | 8,192 |

"Previous" group can appear here. Going forward, the above group should prioritize the latest known version. No generic names, this isn't chatgpt-4o-latest. Anything older not listed here can be presumed dead. Note that 2.0 Flash non-image-gen and older are stable now with dead subversions, and 2.0 Pro doesn't exist anymore.

| "Previous" group |
| - |
| Bro, nothing right now; anything still alive is fake/aliased. |

| "Gemma" group | Display name | Context size | Max output |
| - | - | -: | -: |
| gemma-3-27b-it | Gemma 3 27B | 131,072 | 8,192 |
| gemma-3-12b-it | Gemma 3 12B | 32,768 | 8,192 |
| gemma-3-4b-it | Gemma 3 4B | 32,768 | 8,192 |
| gemma-3-1b-it | Gemma 3 1B | 32,768 | 8,192 |

Leave out Gemma 2 to avoid clutter as these are old with 8,192 context size.

| "Preview" group | Display name | Context size | Max output |
| - | - | -: | -: |
| learnlm-2.0-flash-experimental | LearnLM 2.0 Flash Experimental | 1,048,576 | 32,768 |
| learnlm-1.5-pro-experimental | LearnLM 1.5 Pro Experimental | 32,767<sup>[1]</sup> | 8,192 |

<sup>[1] Not a typo.</sup>

Gemma and Preview groups do not get enough versions or releases to worry about subversions. I don't think they even had subversions yet.

Fix patch:
diff --git a/default/config.yaml b/default/config.yaml
index 1d5e8dc3bf..e7fe7e1967 100644
--- a/default/config.yaml
+++ b/default/config.yaml
@@ -234,6 +234,10 @@ claude:
   # should be ideal for most use cases.
   # Any value other than a non-negative integer will be ignored and caching at depth will not be enabled.
   cachingAtDepth: -1
+# -- GOOGLE GEMINI API CONFIGURATION --
+gemini:
+  # API endpoint version ("v1beta" or "v1alpha")
+  apiVersion: 'v1beta'
 # -- SERVER PLUGIN CONFIGURATION --
 enableServerPlugins: false
 # Attempt to automatically update server plugins on startup
diff --git a/public/index.html b/public/index.html
index f708229d46..4f57d80b47 100644
--- a/public/index.html
+++ b/public/index.html
@@ -2025,7 +2025,7 @@ <h4 class="range-block-title justifyCenter">
                                             <input id="use_makersuite_sysprompt" type="checkbox" />
                                             <span>
                                                 <span data-i18n="Use system prompt">Use system prompt</span>
-                                                <i class="opacity50p fa-solid fa-circle-info" title="Gemini 1.5/2.0 Pro/Flash"></i>
+                                                <i class="opacity50p fa-solid fa-circle-info" title="Gemini 1.5+, LearnLM"></i>
                                             </span>
                                         </label>
                                         <div class="toggle-description justifyLeft marginBot5">
@@ -3146,49 +3146,49 @@ <h4 data-i18n="Google AI Studio API Key">Google AI Studio API Key</h4>
                             <div>
                                 <h4 data-i18n="Google Model">Google Model</h4>
                                 <select id="model_google_select">
-                                    <optgroup label="Primary">
-                                        <option value="gemini-2.0-flash">Gemini 2.0 Flash</option>
-                                        <option value="gemini-1.5-pro">Gemini 1.5 Pro</option>
-                                        <option value="gemini-1.5-flash">Gemini 1.5 Flash</option>
-                                        <option value="gemini-1.0-pro">Gemini 1.0 Pro (Deprecated)</option>
-                                        <option value="gemini-pro">Gemini Pro (1.0) (Deprecated)</option>
-                                        <option value="gemini-ultra">Gemini Ultra (1.0)</option>
-                                        <option value="gemini-1.0-ultra-latest">Gemini 1.0 Ultra</option>
+                                    <optgroup label="Gemini 2.5">
+                                        <option value="gemini-2.5-pro-preview-03-25">gemini-2.5-pro-preview-03-25</option>
+                                        <option value="gemini-2.5-pro-exp-03-25">gemini-2.5-pro-exp-03-25</option>
+                                        <option value="gemini-2.5-flash-preview-04-17">gemini-2.5-flash-preview-04-17</option>
+                                    </optgroup>
+                                    <optgroup label="Gemini 2.0">
+                                        <option value="gemini-2.0-pro-exp-02-05">gemini-2.0-pro-exp-02-05 → 2.5-pro-exp-03-25</option>
+                                        <option value="gemini-2.0-pro-exp">gemini-2.0-pro-exp → 2.5-pro-exp-03-25</option>
+                                        <option value="gemini-exp-1206">gemini-exp-1206 → 2.5-pro-exp-03-25</option>
+                                        <option value="gemini-2.0-flash-001">gemini-2.0-flash-001</option>
+                                        <option value="gemini-2.0-flash-exp-image-generation">gemini-2.0-flash-exp-image-generation</option>
+                                        <option value="gemini-2.0-flash-exp">gemini-2.0-flash-exp</option>
+                                        <option value="gemini-2.0-flash">gemini-2.0-flash</option>
+                                        <option value="gemini-2.0-flash-thinking-exp-01-21">gemini-2.0-flash-thinking-exp-01-21 → 2.5-flash-preview-04-17</option>
+                                        <option value="gemini-2.0-flash-thinking-exp-1219">gemini-2.0-flash-thinking-exp-1219 → 2.5-flash-preview-04-17</option>
+                                        <option value="gemini-2.0-flash-thinking-exp">gemini-2.0-flash-thinking-exp → 2.5-flash-preview-04-17</option>
+                                        <option value="gemini-2.0-flash-lite-001">gemini-2.0-flash-lite-001</option>
+                                        <option value="gemini-2.0-flash-lite-preview-02-05">gemini-2.0-flash-lite-preview-02-05</option>
+                                        <option value="gemini-2.0-flash-lite-preview">gemini-2.0-flash-lite-preview</option>
+                                    </optgroup>
+                                    <optgroup label="Gemini 1.5">
+                                        <option value="gemini-1.5-pro-latest">gemini-1.5-pro-latest</option>
+                                        <option value="gemini-1.5-pro-002">gemini-1.5-pro-002</option>
+                                        <option value="gemini-1.5-pro-001">gemini-1.5-pro-001</option>
+                                        <option value="gemini-1.5-pro">gemini-1.5-pro</option>
+                                        <option value="gemini-1.5-flash-latest">gemini-1.5-flash-latest</option>
+                                        <option value="gemini-1.5-flash-002">gemini-1.5-flash-002</option>
+                                        <option value="gemini-1.5-flash-001">gemini-1.5-flash-001</option>
+                                        <option value="gemini-1.5-flash">gemini-1.5-flash</option>
+                                        <option value="gemini-1.5-flash-8b-001">gemini-1.5-flash-8b-001</option>
+                                        <option value="gemini-1.5-flash-8b-exp-0924">gemini-1.5-flash-8b-exp-0924</option>
+                                        <option value="gemini-1.5-flash-8b-exp-0827">gemini-1.5-flash-8b-exp-0827</option>
+                                        <option value="gemini-1.5-flash-8b">gemini-1.5-flash-8b</option>
                                     </optgroup>
                                     <optgroup label="Gemma">
-                                        <option value="gemma-3-27b-it">Gemma 3 27B</option>
+                                        <option value="gemma-3-27b-it">gemma-3-27b-it</option>
+                                        <option value="gemma-3-12b-it">gemma-3-12b-it</option>
+                                        <option value="gemma-3-4b-it">gemma-3-4b-it</option>
+                                        <option value="gemma-3-1b-it">gemma-3-1b-it</option>
                                     </optgroup>
-                                    <optgroup label="Subversions">
-                                        <option value="gemini-2.5-pro-preview-03-25">Gemini 2.5 Pro Preview 2025-03-25</option>
-                                        <option value="gemini-2.5-pro-exp-03-25">Gemini 2.5 Pro Experimental 2025-03-25</option>
-                                        <option value="gemini-2.0-pro-exp">Gemini 2.0 Pro Experimental</option>
-                                        <option value="gemini-2.0-pro-exp-02-05">Gemini 2.0 Pro Experimental 2025-02-05</option>
-                                        <option value="gemini-2.5-flash-preview-04-17">Gemini 2.5 Flash Preview 2025-04-17</option>
-                                        <option value="gemini-2.0-flash-lite-preview">Gemini 2.0 Flash-Lite Preview</option>
-                                        <option value="gemini-2.0-flash-lite-preview-02-05">Gemini 2.0 Flash-Lite Preview 2025-02-05</option>
-                                        <option value="gemini-2.0-flash-001">Gemini 2.0 Flash [001]</option>
-                                        <option value="gemini-2.0-flash-thinking-exp">Gemini 2.0 Flash Thinking Experimental</option>
-                                        <option value="gemini-2.0-flash-thinking-exp-01-21">Gemini 2.0 Flash Thinking Experimental 2025-01-21</option>
-                                        <option value="gemini-2.0-flash-thinking-exp-1219">Gemini 2.0 Flash Thinking Experimental 2024-12-19</option>
-                                        <option value="gemini-2.0-flash-exp">Gemini 2.0 Flash Experimental</option>
-                                        <option value="gemini-2.0-flash-exp-image-generation">Gemini 2.0 Flash (Image Generation) Experimental</option>
-                                        <option value="gemini-exp-1114">Gemini Experimental 2024-11-14</option>
-                                        <option value="gemini-exp-1121">Gemini Experimental 2024-11-21</option>
-                                        <option value="gemini-exp-1206">Gemini Experimental 2024-12-06</option>
-                                        <option value="gemini-1.5-pro-exp-0801">Gemini 1.5 Pro Experimental 2024-08-01</option>
-                                        <option value="gemini-1.5-pro-exp-0827">Gemini 1.5 Pro Experimental 2024-08-27</option>
-                                        <option value="gemini-1.5-pro-latest">Gemini 1.5 Pro [latest]</option>
-                                        <option value="gemini-1.5-pro-001">Gemini 1.5 Pro [001]</option>
-                                        <option value="gemini-1.5-pro-002">Gemini 1.5 Pro [002]</option>
-                                        <option value="gemini-1.5-flash-8b">Gemini 1.5 Flash 8B</option>
-                                        <option value="gemini-1.5-flash-exp-0827">Gemini 1.5 Flash Experimental 2024-08-27</option>
-                                        <option value="gemini-1.5-flash-8b-exp-0827">Gemini 1.5 Flash 8B Experimental 2024-08-27</option>
-                                        <option value="gemini-1.5-flash-8b-exp-0924">Gemini 1.5 Flash 8B Experimental 2024-09-24</option>
-                                        <option value="gemini-1.5-flash-latest">Gemini 1.5 Flash [latest]</option>
-                                        <option value="gemini-1.5-flash-001">Gemini 1.5 Flash [001]</option>
-                                        <option value="gemini-1.5-flash-002">Gemini 1.5 Flash [002]</option>
-                                        <option value="gemini-1.0-pro-latest">Gemini 1.0 Pro [latest] (Deprecated)</option>
-                                        <option value="gemini-1.0-pro-001">Gemini 1.0 Pro (Tuning) [001] (Deprecated)</option>
+                                    <optgroup label="LearnLM">
+                                        <option value="learnlm-2.0-flash-experimental">learnlm-2.0-flash-experimental</option>
+                                        <option value="learnlm-1.5-pro-experimental">learnlm-1.5-pro-experimental</option>
                                     </optgroup>
                                 </select>
                             </div>
diff --git a/public/scripts/extensions/caption/settings.html b/public/scripts/extensions/caption/settings.html
index 539a737ef0..8b767ca136 100644
--- a/public/scripts/extensions/caption/settings.html
+++ b/public/scripts/extensions/caption/settings.html
@@ -79,34 +79,33 @@
                         <option data-type="anthropic" value="claude-3-haiku-20240307">claude-3-haiku-20240307</option>
                         <option data-type="google" value="gemini-2.5-pro-preview-03-25">gemini-2.5-pro-preview-03-25</option>
                         <option data-type="google" value="gemini-2.5-pro-exp-03-25">gemini-2.5-pro-exp-03-25</option>
-                        <option data-type="google" value="gemini-2.0-pro-exp">gemini-2.0-pro-exp</option>
-                        <option data-type="google" value="gemini-2.0-pro-exp-02-05">gemini-2.0-pro-exp-02-05</option>
                         <option data-type="google" value="gemini-2.5-flash-preview-04-17">gemini-2.5-flash-preview-04-17</option>
-                        <option data-type="google" value="gemini-2.0-flash-lite-preview">gemini-2.0-flash-lite-preview</option>
-                        <option data-type="google" value="gemini-2.0-flash-lite-preview-02-05">gemini-2.0-flash-lite-preview-02-05</option>
-                        <option data-type="google" value="gemini-2.0-flash">gemini-2.0-flash</option>
+                        <option data-type="google" value="gemini-2.0-pro-exp-02-05">gemini-2.0-pro-exp-02-05 → 2.5-pro-exp-03-25</option>
+                        <option data-type="google" value="gemini-2.0-pro-exp">gemini-2.0-pro-exp → 2.5-pro-exp-03-25</option>
+                        <option data-type="google" value="gemini-exp-1206">gemini-exp-1206 → 2.5-pro-exp-03-25</option>
                         <option data-type="google" value="gemini-2.0-flash-001">gemini-2.0-flash-001</option>
-                        <option data-type="google" value="gemini-2.0-flash-exp">gemini-2.0-flash-exp</option>
                         <option data-type="google" value="gemini-2.0-flash-exp-image-generation">gemini-2.0-flash-exp-image-generation</option>
-                        <option data-type="google" value="gemini-2.0-flash-thinking-exp">gemini-2.0-flash-thinking-exp</option>
-                        <option data-type="google" value="gemini-2.0-flash-thinking-exp-01-21">gemini-2.0-flash-thinking-exp-01-21</option>
-                        <option data-type="google" value="gemini-2.0-flash-thinking-exp-1219">gemini-2.0-flash-thinking-exp-1219</option>
-                        <option data-type="google" value="gemini-1.5-flash">gemini-1.5-flash</option>
+                        <option data-type="google" value="gemini-2.0-flash-exp">gemini-2.0-flash-exp</option>
+                        <option data-type="google" value="gemini-2.0-flash">gemini-2.0-flash</option>
+                        <option data-type="google" value="gemini-2.0-flash-thinking-exp-01-21">gemini-2.0-flash-thinking-exp-01-21 → 2.5-flash-preview-04-17</option>
+                        <option data-type="google" value="gemini-2.0-flash-thinking-exp-1219">gemini-2.0-flash-thinking-exp-1219 → 2.5-flash-preview-04-17</option>
+                        <option data-type="google" value="gemini-2.0-flash-thinking-exp">gemini-2.0-flash-thinking-exp → 2.5-flash-preview-04-17</option>
+                        <option data-type="google" value="gemini-2.0-flash-lite-001">gemini-2.0-flash-lite-001</option>
+                        <option data-type="google" value="gemini-2.0-flash-lite-preview-02-05">gemini-2.0-flash-lite-preview-02-05</option>
+                        <option data-type="google" value="gemini-2.0-flash-lite-preview">gemini-2.0-flash-lite-preview</option>
+                        <option data-type="google" value="gemini-1.5-pro-latest">gemini-1.5-pro-latest</option>
+                        <option data-type="google" value="gemini-1.5-pro-002">gemini-1.5-pro-002</option>
+                        <option data-type="google" value="gemini-1.5-pro-001">gemini-1.5-pro-001</option>
+                        <option data-type="google" value="gemini-1.5-pro">gemini-1.5-pro</option>
                         <option data-type="google" value="gemini-1.5-flash-latest">gemini-1.5-flash-latest</option>
-                        <option data-type="google" value="gemini-1.5-flash-001">gemini-1.5-flash-001</option>
                         <option data-type="google" value="gemini-1.5-flash-002">gemini-1.5-flash-002</option>
-                        <option data-type="google" value="gemini-1.5-flash-exp-0827">gemini-1.5-flash-exp-0827</option>
-                        <option data-type="google" value="gemini-1.5-flash-8b-exp-0827">gemini-1.5-flash-8b-exp-0827</option>
+                        <option data-type="google" value="gemini-1.5-flash-001">gemini-1.5-flash-001</option>
+                        <option data-type="google" value="gemini-1.5-flash">gemini-1.5-flash</option>
+                        <option data-type="google" value="gemini-1.5-flash-8b-001">gemini-1.5-flash-8b-001</option>
                         <option data-type="google" value="gemini-1.5-flash-8b-exp-0924">gemini-1.5-flash-8b-exp-0924</option>
-                        <option data-type="google" value="gemini-exp-1114">gemini-exp-1114</option>
-                        <option data-type="google" value="gemini-exp-1121">gemini-exp-1121</option>
-                        <option data-type="google" value="gemini-exp-1206">gemini-exp-1206</option>
-                        <option data-type="google" value="gemini-1.5-pro">gemini-1.5-pro</option>
-                        <option data-type="google" value="gemini-1.5-pro-latest">gemini-1.5-pro-latest</option>
-                        <option data-type="google" value="gemini-1.5-pro-001">gemini-1.5-pro-001</option>
-                        <option data-type="google" value="gemini-1.5-pro-002">gemini-1.5-pro-002</option>
-                        <option data-type="google" value="gemini-1.5-pro-exp-0801">gemini-1.5-pro-exp-0801</option>
-                        <option data-type="google" value="gemini-1.5-pro-exp-0827">gemini-1.5-pro-exp-0827</option>
+                        <option data-type="google" value="gemini-1.5-flash-8b-exp-0827">gemini-1.5-flash-8b-exp-0827</option>
+                        <option data-type="google" value="learnlm-2.0-flash-experimental">learnlm-2.0-flash-experimental</option>
+                        <option data-type="google" value="learnlm-1.5-pro-experimental">learnlm-1.5-pro-experimental</option>
                         <option data-type="groq" value="llama-3.2-11b-vision-preview">llama-3.2-11b-vision-preview</option>
                         <option data-type="groq" value="llama-3.2-90b-vision-preview">llama-3.2-90b-vision-preview</option>
                         <option data-type="groq" value="llava-v1.5-7b-4096-preview">llava-v1.5-7b-4096-preview</option>
diff --git a/public/scripts/openai.js b/public/scripts/openai.js
index 2eb809a922..d1b996c370 100644
--- a/public/scripts/openai.js
+++ b/public/scripts/openai.js
@@ -4481,20 +4481,16 @@ async function onModelChange() {
     if (oai_settings.chat_completion_source == chat_completion_sources.MAKERSUITE) {
         if (oai_settings.max_context_unlocked) {
             $('#openai_max_context').attr('max', max_2mil);
-        } else if (value.includes('gemini-exp-1114') || value.includes('gemini-exp-1121') || value.includes('gemini-2.0-flash-thinking-exp-1219')) {
-            $('#openai_max_context').attr('max', max_32k);
-        } else if (value.includes('gemini-1.5-pro') || value.includes('gemini-exp-1206') || value.includes('gemini-2.0-pro')) {
+        } else if (value.includes('gemini-1.5-pro')) {
             $('#openai_max_context').attr('max', max_2mil);
-        } else if (value.includes('gemini-1.5-flash') || value.includes('gemini-2.0-flash') || value.includes('gemini-2.5-flash-preview-04-17') || value.includes('gemini-2.5-pro-exp-03-25') || value.includes('gemini-2.5-pro-preview-03-25')) {
+        } else if (value.includes('gemini-1.5-flash') || value.includes('gemini-2.0-flash') || value.includes('gemini-2.0-pro') || value.includes('gemini-exp') || value.includes('gemini-2.5-flash') || value.includes('gemini-2.5-pro') || value.includes('learnlm-2.0-flash')) {
             $('#openai_max_context').attr('max', max_1mil);
-        } else if (value.includes('gemini-1.0-pro') || value === 'gemini-pro') {
-            $('#openai_max_context').attr('max', max_32k);
-        } else if (value.includes('gemini-1.0-ultra') || value === 'gemini-ultra') {
-            $('#openai_max_context').attr('max', max_32k);
-        } else if (value.includes('gemma-3')) {
+        } else if (value.includes('gemma-3-27b-it')) {
             $('#openai_max_context').attr('max', max_128k);
+        } else if (value.includes('gemma-3') || value.includes('learnlm-1.5-pro-experimental')) {
+            $('#openai_max_context').attr('max', max_32k);
         } else {
-            $('#openai_max_context').attr('max', max_4k);
+            $('#openai_max_context').attr('max', max_32k);
         }
         let makersuite_max_temp = (value.includes('vision') || value.includes('ultra') || value.includes('gemma')) ? 1.0 : 2.0;
         oai_settings.temp_openai = Math.min(makersuite_max_temp, oai_settings.temp_openai);
@@ -5152,9 +5148,8 @@ export function isImageInliningSupported() {
         'gemini-1.5',
         'gemini-2.0',
         'gemini-2.5',
-        'gemini-exp-1114',
-        'gemini-exp-1121',
         'gemini-exp-1206',
+        'learnlm',
         // MistralAI
         'mistral-small-2503',
         'mistral-small-latest',
@@ -5168,7 +5163,7 @@ export function isImageInliningSupported() {
         case chat_completion_sources.OPENAI:
             return visionSupportedModels.some(model =>
                 oai_settings.openai_model.includes(model)
-                && ['gpt-4-turbo-preview', 'o1-mini', 'o3-mini'].some(x => !oai_settings.openai_model.includes(x))
+                && ['gpt-4-turbo-preview', 'o1-mini', 'o3-mini'].some(x => !oai_settings.openai_model.includes(x)),
             );
         case chat_completion_sources.MAKERSUITE:
             return visionSupportedModels.some(model => oai_settings.google_model.includes(model));
diff --git a/src/constants.js b/src/constants.js
index 64b9330b21..3b18e732f9 100644
--- a/src/constants.js
+++ b/src/constants.js
@@ -156,7 +156,7 @@ export const GEMINI_SAFETY = [
     },
     {
         category: 'HARM_CATEGORY_CIVIC_INTEGRITY',
-        threshold: 'BLOCK_NONE',
+        threshold: 'OFF',
     },
 ];
 
diff --git a/src/endpoints/backends/chat-completions.js b/src/endpoints/backends/chat-completions.js
index adc62e6415..e440d6c015 100644
--- a/src/endpoints/backends/chat-completions.js
+++ b/src/endpoints/backends/chat-completions.js
@@ -343,8 +343,8 @@ async function sendMakerSuiteRequest(request, response) {
     const enableWebSearch = Boolean(request.body.enable_web_search);
     const requestImages = Boolean(request.body.request_images);
     const reasoningEffort = String(request.body.reasoning_effort);
-    const isThinking = model.includes('thinking');
     const isGemma = model.includes('gemma');
+    const isLearnLM = model.includes('learnlm');
 
     const generationConfig = {
         stopSequences: request.body.stop,
@@ -358,48 +358,60 @@ async function sendMakerSuiteRequest(request, response) {
     };
 
     function getGeminiBody() {
+        // #region UGLY MODEL LISTS AREA
+        const imageGenerationModels =  [
+            'gemini-2.0-flash-exp',
+            'gemini-2.0-flash-exp-image-generation',
+        ];
+
+        // These models do not support setting the threshold to OFF at all.
+        const blockNoneModels = [
+            'gemini-1.5-pro-001',
+            'gemini-1.5-flash-001',
+            'gemini-1.5-flash-8b-exp-0827',
+            'gemini-1.5-flash-8b-exp-0924',
+        ];
+
+        const thinkingBudgetModels = [
+            'gemini-2.5-flash-preview-04-17',
+        ];
+
+        const noSearchModels = [
+            'gemini-2.0-flash-lite',
+            'gemini-2.0-flash-lite-001',
+            'gemini-2.0-flash-lite-preview-02-05',
+            'gemini-1.5-flash-8b-exp-0924',
+            'gemini-1.5-flash-8b-exp-0827',
+        ];
+        // #endregion
+
         if (!Array.isArray(generationConfig.stopSequences) || !generationConfig.stopSequences.length) {
             delete generationConfig.stopSequences;
         }
 
-        const useMultiModal = requestImages && ['gemini-2.0-flash-exp', 'gemini-2.0-flash-exp-image-generation'].includes(model);
-        if (useMultiModal) {
+        const enableImageModality = requestImages && imageGenerationModels.includes(model);
+        if (enableImageModality) {
             generationConfig.responseModalities = ['text', 'image'];
         }
 
-        const useSystemPrompt = !useMultiModal && (
-            model.includes('gemini-2.5-pro') ||
-            model.includes('gemini-2.5-flash') ||
-            model.includes('gemini-2.0-pro') ||
-            model.includes('gemini-2.0-flash') ||
-            model.includes('gemini-2.0-flash-thinking-exp') ||
-            model.includes('gemini-1.5-flash') ||
-            model.includes('gemini-1.5-pro') ||
-            model.startsWith('gemini-exp')
-        ) && request.body.use_makersuite_sysprompt;
+        const useSystemPrompt = !enableImageModality && !isGemma && request.body.use_makersuite_sysprompt;
 
         const tools = [];
         const prompt = convertGooglePrompt(request.body.messages, model, useSystemPrompt, getPromptNames(request));
         let safetySettings = GEMINI_SAFETY;
 
-        // These models do not support setting the threshold to OFF at all.
-        if (['gemini-1.5-pro-001', 'gemini-1.5-flash-001', 'gemini-1.5-flash-8b-exp-0827', 'gemini-1.5-flash-8b-exp-0924', 'gemini-pro', 'gemini-1.0-pro', 'gemini-1.0-pro-001', 'gemma-3-27b-it'].includes(model)) {
+        if (blockNoneModels.includes(model)) {
             safetySettings = GEMINI_SAFETY.map(setting => ({ ...setting, threshold: 'BLOCK_NONE' }));
         }
-        // Interestingly, Gemini 2.0 Flash does support setting the threshold for HARM_CATEGORY_CIVIC_INTEGRITY to OFF.
-        else if (['gemini-2.0-flash', 'gemini-2.0-flash-001', 'gemini-2.0-flash-exp', 'gemini-2.0-flash-exp-image-generation'].includes(model)) {
-            safetySettings = GEMINI_SAFETY.map(setting => ({ ...setting, threshold: 'OFF' }));
-        }
-        // Most of the other models allow for setting the threshold of filters, except for HARM_CATEGORY_CIVIC_INTEGRITY, to OFF.
 
-        if (enableWebSearch && !useMultiModal && !isGemma) {
-            const searchTool = model.includes('1.5') || model.includes('1.0')
+        if (enableWebSearch && !enableImageModality && !isGemma && !isLearnLM && !noSearchModels.includes(model)) {
+            const searchTool = model.includes('1.5')
                 ? ({ google_search_retrieval: {} })
                 : ({ google_search: {} });
             tools.push(searchTool);
         }
 
-        if (Array.isArray(request.body.tools) && request.body.tools.length > 0 && !useMultiModal && !isGemma) {
+        if (Array.isArray(request.body.tools) && request.body.tools.length > 0 && !enableImageModality && !isGemma) {
             const functionDeclarations = [];
             for (const tool of request.body.tools) {
                 if (tool.type === 'function') {
@@ -415,11 +427,6 @@ async function sendMakerSuiteRequest(request, response) {
             tools.push({ function_declarations: functionDeclarations });
         }
 
-        // One more models list to maintain, yay
-        const thinkingBudgetModels = [
-            'gemini-2.5-flash-preview-04-17',
-        ];
-
         if (thinkingBudgetModels.includes(model)) {
             const thinkingBudget = calculateGoogleBudgetTokens(generationConfig.maxOutputTokens, reasoningEffort);
 
@@ -455,7 +462,7 @@ async function sendMakerSuiteRequest(request, response) {
             controller.abort();
         });
 
-        const apiVersion = isThinking ? 'v1alpha' : 'v1beta';
+        const apiVersion = getConfigValue('gemini.apiVersion', 'v1beta');
         const responseType = (stream ? 'streamGenerateContent' : 'generateContent');
 
         const generateResponse = await fetch(`${apiUrl.toString().replace(/\/$/, '')}/${apiVersion}/models/${model}:${responseType}?key=${apiKey}${stream ? '&alt=sse' : ''}`, {
@@ -466,7 +473,7 @@ async function sendMakerSuiteRequest(request, response) {
             },
             signal: controller.signal,
         });
-        // have to do this because of their busted ass streaming endpoint
+
         if (stream) {
             try {
                 // Pipe remote SSE stream to Express response


Test patch: