From b48d802930d5c05e64a3d60975b04f05e1f57751 Mon Sep 17 00:00:00 2001 From: Jason <101583541+JasonOA888@users.noreply.github.com> Date: Thu, 9 Apr 2026 09:03:45 +0800 Subject: [PATCH] fix(ai): correct thinking budget for 2.5-flash-lite models (#2861) The 2.5-flash-lite model was incorrectly matching the 2.5-flash case, setting minimal budget to 128. Per Google's docs, flash-lite's minimum thinking budget is 512, not 128. This caused the error: The thinking budget 128 is invalid. Please choose a value between 512 and 24576. Add a dedicated 2.5-flash-lite case before the 2.5-flash case so the more specific match takes priority. Fixes #2838 Co-authored-by: JasonOA888 --- packages/ai/src/providers/google.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/ai/src/providers/google.ts b/packages/ai/src/providers/google.ts index f0460a31..d1f1239a 100644 --- a/packages/ai/src/providers/google.ts +++ b/packages/ai/src/providers/google.ts @@ -462,6 +462,16 @@ function getGoogleBudget( return budgets[effort]; } + if (model.id.includes("2.5-flash-lite")) { + const budgets: Record = { + minimal: 512, + low: 2048, + medium: 8192, + high: 24576, + }; + return budgets[effort]; + } + if (model.id.includes("2.5-flash")) { const budgets: Record = { minimal: 128,