Regression - Gemini flash lite with thinking broken after upgrade to 2026.8.0

After updating discourse to v2026.8.0 LLM using Gemini Flash Lite with thinking enabled throws an error 400.

Here’s the configuration (that working before the upgrade)

When I run it now it throws

Non-streaming request failed: { “error”: { “code”: 400, “message”: “Request contains an invalid argument.”, “status”: “INVALID_ARGUMENT” } }

If I disable thinking then it works.

I enable thinking, the issue goes back to a regression bug that I had reported last year, it appears I need to hardcode the number of tokens used for thinking and it won’t accept 0 or -1 and won’t accept nothing even though it says it’s optional.

It only seems to affect the Flash Lite model but not the Flash model (which works just fine even without any thinking tokens specified and thinking enabled).

The Pro model is completely broken, I can’t get it work at all after the upgrade, I get an internal server error.

Why are you using the legacy API? Can you switch to the non-legacy API and use: gemini-3.5-flash-lite?