Gemini API returns empty text with finishReason MAX_TOKENS: thinking tokens use the limit first A developer reproduced a silent failure in the Gemini API where thinking tokens consume the max_output_tokens budget before any answer text is generated, returning HTTP 200 with an empty string and finishReason MAX_TOKENS. In a 10 November 2026 test with one arithmetic prompt, gemini-3.6-flash at high thinking spent 57 thought tokens and produced zero characters at a 60-token limit, while gemini-3-flash-preview used 21,607 thinking tokens at high with no limit set. The developer recommends checking candidates[0].finish_reason before reading text and comparing thoughts_token_count against candidates_token_count to diagnose where the budget went. On Gemini models that think, the tokens spent on reasoning count against max output tokens before the first word of the answer is written. The failure is quiet: no exception, HTTP 200, and a response whose text is an empty string. I reproduced it on purpose on 10 November 2026 with one arithmetic question a train problem with a known answer, 11:49, asked for in one sentence, so a correct reply is about 15 tokens and a ladder of output limits, recording the token counts the API reports. Everything below is from that run with one free-tier key. python from google import genai from google.genai import types client = genai.Client def run model, level, max tokens=None : cfg = types.GenerateContentConfig thinking config=types.ThinkingConfig thinking level=level , max output tokens=max tokens, r = client.models.generate content model=model, contents=PROMPT, config=cfg u = r.usage metadata return { "finish": r.candidates 0 .finish reason, "text chars": len r.text or "" , "thoughts": u.thoughts token count, "answer tokens": u.candidates token count, } run "gemini-3.6-flash", "high", 60 returned MAX TOKENS , zero characters of text, 57 thought tokens and 0 answer tokens. The usage fields are the diagnosis: thoughts token count next to candidates token count shows where the budget went. At a limit of 60, gemini-3-flash-preview spent 56 tokens on thoughts and returned an empty string. gemini-3.5-flash-lite spent 53 on thoughts and returned 3 answer tokens, the words "They will meet". All ended with MAX TOKENS , but only some gave an empty string to notice; the others gave a fragment that looks like text. On gemini-3.6-flash at high thinking, thinking took almost the whole allowance every time: A truncated reply is worse than an empty one for a pipeline, because that cut-off text passes an if text: check. Without any limit, gemini-3-flash-preview used 21,607 thinking tokens at high and 1,325 at low for the same question. A limit of a few hundred is far too small for a thinking model, and 4,000 was still not enough at high on that model: the answer came back cut off after 160 tokens. Lowering the level is not free either: gemini-3.5-flash-lite at low used 0 thinking tokens and answered 12:00 PM, where the right answer is 11:49. candidates 0 .finish reason before you read text ; an empty text together with MAX TOKENS means the budget was spent on thinking. thoughts token count and candidates token count together. One question, one free-tier key, one day. Some models hit their daily free quota during the work, which is why the results mix models. Model behaviour and limits change, so run the probe on your own setup. More detail and the FAQ: https://aiandsoftwarehub.com/blog/gemini-api-returns-empty-text-with-finishreason-max-tokens-thinking-tokens-eat-y https://aiandsoftwarehub.com/blog/gemini-api-returns-empty-text-with-finishreason-max-tokens-thinking-tokens-eat-y