Claude Extended Thinking budget_tokens Error
Your Extended Thinking configuration is invalid. Common causes: budget_tokens exceeds max_tokens, budget below minimum (1024), or using thinking on a model that doesn't support it.
Set budget_tokens BELOW max_tokens (thinking tokens are inside max_tokens). Minimum 1024, recommended 4000-16000 for complex reasoning. Model must support extended thinking (Opus 4, Sonnet 4.5+).
The Error Message You're Seeing
HTTP/1.1 400 Bad Request
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "thinking.budget_tokens (16000) must be less than max_tokens (8192)"
}
}
Variants: "budget_tokens must be at least 1024", "thinking not supported for model claude-haiku-4-5", "thinking.type must be 'enabled'".
What Actually Causes This Error
type: "enabled", or using wrong field name.Fixes That Work (Tested Nov 2026)
1Correct Budget and max_tokens Relationship
2Choose Budget Based on Task Complexity
| Task Type | Recommended budget_tokens | Notes |
|---|---|---|
| Simple reasoning | 1,024 - 2,048 | Baseline; often not worth thinking |
| Multi-step problems | 4,000 - 8,000 | Good for most reasoning tasks |
| Complex analysis | 10,000 - 16,000 | Research, planning, coding architecture |
| Deep reasoning | 20,000 - 32,000 | Very complex tasks; diminishing returns |
| Maximum | Up to 128,000 | Rare — usually wasteful |
Thinking tokens are billed at output-token rates. A 16000-token thinking budget on Sonnet costs $0.24 per request just for reasoning. Use thinking selectively for tasks that actually benefit.
3Verify Model Supports Extended Thinking
Preventing This Error Going Forward
- Always set max_tokens = budget_tokens + expected_output. Budget 4000 thinking + 2000 output = max_tokens 6000+.
- Enable thinking selectively. Not every request benefits — reserve for genuinely complex reasoning.
- Monitor thinking token usage. Response includes thinking token count — track waste.
- Route by task complexity. Simple queries to Haiku (no thinking); complex queries to Sonnet/Opus with thinking.
- Cache thinking for reproducibility. Save both thinking and answer if you need auditable reasoning.
Researcher · AI Error Hub
Frequently Asked Questions
For complex reasoning, math, coding, and multi-step planning — significantly yes. For simple factual queries, conversational tasks, or creative writing — minimal benefit. The cost/quality tradeoff favors thinking on hard tasks only.
Yes. Response includes both thinking and text content blocks. The thinking block shows Claude's reasoning; the text block shows the final answer. Display separately or hide thinking from users depending on your product.
Yes, and it's particularly powerful. Claude thinks about which tools to use, why, and in what order before calling them. This dramatically improves agentic workflows on complex tasks.
Yes if you want to show reasoning UX. Thinking blocks stream just like text. Many products display thinking in an "expandable" UI element so users can see reasoning without cluttering the main response.
Cache reads work — cached input tokens are still cheaper. But thinking tokens themselves are not cached across requests. Each request generates fresh thinking.
Related Errors
Master Extended Thinking & Reasoning APIs
Weekly comparisons of Claude thinking vs OpenAI o1/o3 vs DeepSeek R1 vs Gemini reasoning. 12,000+ developers subscribe.
Subscribe Free →