fix: cap gemini-3.1-pro maxOutputTokens and filter live models

- Reduce maxOutputTokens from 131072 to 65535 for gemini-3.1-pro-high
  and gemini-3.1-pro-low, fixing 400 "invalid argument" errors from
  Open WebUI when no max_tokens is specified (upstream limit is 65535)
- Filter non-viable models (gemini-3.1-flash-image-preview,
  gemini-2.5-flash-preview-image-generation, gemini-3-pro-high/low)
  from the live upstream API response in /api/providers/[id]/models
This commit is contained in:
Chris Staley
2026-03-31 23:10:57 -06:00
parent 3fad8479ca
commit 5df8abcddf
2 changed files with 11 additions and 3 deletions
+9 -1
View File
@@ -154,7 +154,15 @@ const PROVIDER_MODELS_CONFIG: Record<string, ProviderModelsConfigEntry> = {
authHeader: "Authorization",
authPrefix: "Bearer ",
body: {},
parseResponse: (data) => data.models || [],
parseResponse: (data) => {
const excluded = new Set([
"gemini-2.5-flash-preview-image-generation",
"gemini-3.1-flash-image-preview",
"gemini-3-pro-low",
"gemini-3-pro-high",
]);
return (data.models || []).filter((m: any) => !excluded.has(m.model || m.id));
},
},
openai: {
url: "https://api.openai.com/v1/models",
+2 -2
View File
@@ -32,7 +32,7 @@ export const MODEL_SPECS: Record<string, ModelSpec> = {
// ── Gemini 3.1 Pro High ─────────────────────────────────────────
"gemini-3.1-pro-high": {
maxOutputTokens: 131072,
maxOutputTokens: 65535,
contextWindow: 1048576,
defaultThinkingBudget: 24576,
thinkingBudgetCap: 32768,
@@ -45,7 +45,7 @@ export const MODEL_SPECS: Record<string, ModelSpec> = {
// ── Gemini 3.1 Pro Low ──────────────────────────────────────────
"gemini-3.1-pro-low": {
maxOutputTokens: 131072,
maxOutputTokens: 65535,
contextWindow: 1048576,
defaultThinkingBudget: 8192,
thinkingBudgetCap: 16000,