Claude Extended Thinking Budget Error — Fix (2026) | AI Error Hub
Anthropic Claude Extended Thinking Severity: Medium HTTP 400

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.

Error code: invalid_request_error HTTP: 400 Category: Extended Thinking Last tested: Nov 14, 2026
Quick Fix (TL;DR)

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

Response body
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

44%
budget_tokens exceeds max_tokensThinking tokens are counted inside max_tokens. Budget of 16000 requires max_tokens of at least 17000.
28%
Model doesn't support extended thinkingOnly certain models support it: Opus 4, Sonnet 4.5. Haiku and older models don't.
14%
budget_tokens below minimumMinimum is 1024. Setting 512 or 1000 fails.
10%
Malformed thinking parameterMissing type: "enabled", or using wrong field name.
4%
Combined with unsupported featureSome feature combinations (streaming + thinking + tools) may have restrictions.

Fixes That Work (Tested Nov 2026)

1Correct Budget and max_tokens Relationship

Python · correct thinking config
# CORRECT: budget_tokens must be LESS than max_tokens # Rule of thumb: max_tokens = budget_tokens + expected_output response = client.messages.create( model="claude-sonnet-4-5", max_tokens=24000, # 16000 thinking + 8000 output thinking={ "type": "enabled", "budget_tokens": 16000 # must be < max_tokens }, messages=[{ "role": "user", "content": "Complex reasoning task..." }] ) # Access thinking output separately from response for block in response.content: if block.type == "thinking": print("Reasoning:", block.thinking) elif block.type == "text": print("Answer:", block.text)

2Choose Budget Based on Task Complexity

Task TypeRecommended budget_tokensNotes
Simple reasoning1,024 - 2,048Baseline; often not worth thinking
Multi-step problems4,000 - 8,000Good for most reasoning tasks
Complex analysis10,000 - 16,000Research, planning, coding architecture
Deep reasoning20,000 - 32,000Very complex tasks; diminishing returns
MaximumUp to 128,000Rare — usually wasteful
Cost implications

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

Python · thinking-capable models
THINKING_MODELS = { "claude-opus-4", "claude-sonnet-4-5", # Add newer models as they release } def call_with_thinking(model, prompt, budget=4000): if model not in THINKING_MODELS: print(f"Warning: {model} does not support extended thinking") return client.messages.create( model=model, max_tokens=2048, messages=[{"role": "user", "content": prompt}] ) return client.messages.create( model=model, max_tokens=budget + 2048, thinking={"type": "enabled", "budget_tokens": budget}, messages=[{"role": "user", "content": prompt}] )

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.
SK
Tested by Sana K.
Researcher · AI Error Hub
Last verified: Nov 14, 2026 · Feature: Extended Thinking GA

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.