Gemini 2.5 Thinking Budget Exceeded / Response Empty
You get an empty response with reasoning tokens burned when Gemini 2.5's thinking_budget is too low for the task. Fix by increasing budget, using dynamic thinking (-1), disabling thinking on 2.5 Flash for simple tasks (0), or routing to Pro vs Flash based on complexity.
usage.thoughts_token_count hits budget, empty textCategory: ThinkingFeature: Gemini 2.5 series onlyLast tested: Nov 15, 2026On Gemini 2.5 Pro, thinking is always ON with dynamic budget (128–32,768 tokens). On 2.5 Flash you can control it: thinking_budget=0 disables, -1 is dynamic, or a specific integer (up to 24,576). Empty response? Set budget to 8,192+ for complex tasks. Enable include_thoughts to inspect reasoning summaries.
The Symptoms You're Seeing
response.text = "" # empty
response.candidates[0].finish_reason = "STOP" # but no content
response.usage_metadata:
prompt_token_count: 512
candidates_token_count: 0 ← nothing visible
thoughts_token_count: 24576 ← all budget used on thinking
total_token_count: 25088
Model spent budget reasoning; had nothing left for output.
Or for wrong-model usage:
{
"error": {
"code": 400,
"message": "Field 'thinking_config' is not supported for
model 'gemini-2.0-flash'.",
"status": "INVALID_ARGUMENT"
}
}Thinking Support by Model
| Model | Thinking | Budget range | Default |
|---|---|---|---|
| gemini-2.5-pro | Always on | 128 – 32,768 | Dynamic (-1) |
| gemini-2.5-flash | Configurable | 0 – 24,576 | Dynamic (-1) |
| gemini-2.5-flash-lite | Configurable | 0 – 24,576 | 0 (off) |
| gemini-2.0-flash | Not supported | N/A | N/A |
| gemini-2.0-flash-thinking-exp | Preview only | Deprecated | Retiring |
What Actually Causes This Error
Fixes That Work (Tested Nov 2026)
1Use Dynamic Thinking Budget
2Task-Based Budget Selection
Reasoning tokens billed at OUTPUT rate. On 2.5 Flash paid tier that's ~$0.30/M output. A hard math problem using 20K reasoning tokens costs about $0.006 just for thinking. Multiply by traffic — thinking budget = cost lever.
3Handle Empty Output from Overrun
Preventing This Error Going Forward
- Default to dynamic budget (-1) unless cost-sensitive.
- Set 0 for simple tasks on Flash / Flash-Lite. Saves tokens + latency.
- Fixed budgets only when you can benchmark actual usage.
- Track thoughts_token_count in logs. Tune from real data.
- Enable include_thoughts in dev/staging. Debug reasoning drift.
- Choose model by need for thinking. 2.5 Pro is always-on; use Flash for control.
Researcher · AI Error Hub
Frequently Asked Questions
Yes — set include_thoughts=True and iterate candidates[0].content.parts; parts with thought=True contain reasoning summaries (not full trace). Full reasoning tokens counted but summarized for readability.
Yes — both thinking and visible output share the total generation budget. Set generous max_output_tokens (16K+) when thinking is high-budget, or specify thinking_budget explicitly and let visible output share the rest.
Yes — you can't disable it on 2.5 Pro. You can set thinking_budget to control the range (min 128, max 32,768). Off is not an option; that's the model design.
Usually no. Flash-Lite is optimized for high-throughput classification/extraction — thinking adds cost and latency without much quality gain on those tasks. Reserve thinking for Flash or Pro when reasoning matters.
Not always — dynamic scales to task complexity but caps at 24,576 (Flash) or 32,768 (Pro). Extremely hard problems may still consume the max. Monitor thoughts_token_count; if consistently near cap, tasks may need model upgrade or breaking into steps.
Related Errors
Master Gemini Thinking Mode
Weekly deep dives on 2.5 series, reasoning budgets, and cost tuning. 12,000+ developers subscribe.
Subscribe Free →