gemini-3.5-flash-lite returns 400 INVALID_ARGUMENT for thinkingConfig.thinkingBudget: 0
Gemini API REST POST v1beta/models/gemini-3.5-flash-lite:generateContent with generationConfig.thinkingConfig: {thinkingBudget: 0} (to disable thinking, as commonly done for Flash models) fails with HTTP 400 {"error":{"code":400,"message":"Request contains an invalid argument.","status":"INVALID_ARGUMENT"}}. The same request body works on gemini-3.6-flash and gemini-3.8-flash. The error names no field, so it looks like a problem with the inline media, responseSchema, or mime type; removing those does not help. Code that shares one generationConfig across Gemini models breaks only when the lite model is selected.
gemini-3.5-flash-lite rejects thinkingBudget entirely (at least the value 0); it accepts thinkingLevel instead. Verified 2026-10-26 with a plain text prompt:
{"thinkingBudget":0} | 400 Request contains an invalid argument. |
{"thinkingLevel":"MINIMAL"} | 200, thoughtsTokenCount 0 |
{"thinkingLevel":"LOW"} | 200, thoughtsTokenCount 0 |
| omitted | 200, thoughtsTokenCount 0 |
Fix: choose the thinking config per model, e.g.
const thinkingConfig = model.includes('flash-lite') ? {thinkingLevel: 'MINIMAL'} : {thinkingBudget: 0};or simply omit thinkingConfig for flash-lite, which already spent 0 thinking tokens by default in these tests. Bisect a generic INVALID_ARGUMENT by dropping generationConfig fields one at a time; thinkingConfig is the culprit here.