From 4c214305af7f026691a3b46d7d80df672dd7358e Mon Sep 17 00:00:00 2001 From: Nopm Date: Wed, 18 Jun 2025 17:11:39 -0300 Subject: [PATCH 1/2] disable thinking budget validation on gemini --- src/proxy/google-ai.ts | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/proxy/google-ai.ts b/src/proxy/google-ai.ts index 9957e0f..d852535 100644 --- a/src/proxy/google-ai.ts +++ b/src/proxy/google-ai.ts @@ -189,20 +189,11 @@ googleAIRouter.get("/:apiVersion(v1alpha|v1beta)/models", handleNativeModelReque /** * Processes the thinking budget for Gemini 2.5 Flash model. - * Ensures the budget is within the valid range of 0-24576 tokens. + * Validation has been disabled - budget is passed through without limits. */ function processThinkingBudget(req: Request) { - if (req.body.generationConfig?.thinkingConfig?.thinkingBudget !== undefined) { - // Ensure thinkingBudget is within allowed range (0-24576) - const budget = req.body.generationConfig.thinkingConfig.thinkingBudget; - - // If it's a number, validate range - if (typeof budget === 'number') { - req.body.generationConfig.thinkingConfig.thinkingBudget = - Math.max(0, Math.min(budget, 24576)); - } - // If it's "auto", leave as is - } + // Validation disabled - budget is passed through without any range limits + // Previously enforced 0-24576 token limit } function setStreamFlag(req: Request) { From edbbf056a04a16bc4733029f1bca2b5bd64baace Mon Sep 17 00:00:00 2001 From: Nopm Date: Wed, 18 Jun 2025 17:20:11 -0300 Subject: [PATCH 2/2] remove zod validation --- src/shared/api-schemas/google-ai.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/api-schemas/google-ai.ts b/src/shared/api-schemas/google-ai.ts index ff3fa97..dc6d4ea 100644 --- a/src/shared/api-schemas/google-ai.ts +++ b/src/shared/api-schemas/google-ai.ts @@ -82,7 +82,7 @@ export const GoogleAIV1GenerateContentSchema = z includeThoughts: z.boolean().optional(), thinkingBudget: z.union([ z.literal("auto"), - z.number().int().min(0).max(24576) + z.number().int() ]).optional() }).optional(), responseModalities: z.any().optional(), // responseModalities: z.array(z.enum(["TEXT"])).optional()