Clawist
📖 Guide11 min read••By OpenClaw Team

Claude Extended Thinking Mode: When and How to Use Deep Reasoning

Claude Extended Thinking Mode: When and How to Use Deep Reasoning

Claude's extended thinking mode enables deeper reasoning on complex problems by allowing the model to "think" longer before responding. Instead of immediately generating an answer, Claude spends additional compute exploring the problem space, considering alternatives, and verifying its reasoning. This produces higher-quality outputs for tasks that require careful analysis, multi-step logic, or nuanced judgment.

Extended thinking mode isn't necessary for simple queries, but for complex problems—strategic business decisions, intricate code review, research analysis—it dramatically improves accuracy and insight depth.

Understanding Extended Thinking Architecture

Diagram showing standard vs extended thinking processing Extended thinking adds a reasoning phase before output generation

Standard Claude responses use the model's trained pattern recognition to generate outputs quickly. Extended thinking adds an explicit reasoning phase where the model articulates its thought process, explores alternatives, and validates conclusions before committing to an answer.

This architecture mirrors human problem-solving: instead of blurting out the first answer that comes to mind, you think through the problem systematically. Extended thinking makes this internal deliberation visible and structured.

The tradeoff is time and cost. Extended thinking responses take longer to generate and consume more API tokens. Use it strategically for high-value tasks where accuracy matters more than speed.

Step 1: Identify When Extended Thinking Helps

Decision tree for choosing extended thinking mode Use extended thinking for complex, high-stakes, or multi-step reasoning tasks

Extended thinking shines in specific scenarios:

Use extended thinking for:

  • Strategic business decisions with multiple factors
  • Code review requiring deep logic verification
  • Research analysis with conflicting sources
  • Mathematical proofs and complex calculations
  • Ethical dilemmas requiring nuanced judgment
  • Architectural design decisions
  • Debugging complex, intermittent bugs
  • Legal or regulatory interpretation

Don't use extended thinking for:

  • Simple factual questions
  • Quick content generation
  • Basic code completion
  • Routine data formatting
  • Simple translation tasks
  • FAQ responses

Ask yourself: "Would I benefit from spending 10 minutes thinking about this myself?" If yes, extended thinking probably helps.

Step 2: Enable Extended Thinking in API Calls

API request showing extended thinking parameter Enable extended thinking with the thinking parameter in your API requests

Enable extended thinking via the Anthropic API with the thinking parameter:

const response = await anthropic.messages.create({
  model: 'claude-opus-4',
  max_tokens: 4096,
  thinking: {
    type: 'enabled',
    budget_tokens: 2000 // Optional: limit thinking tokens
  },
  messages: [{
    role: 'user',
    content: 'Analyze the architectural tradeoffs between microservices and monolith for a 50-person startup...'
  }]
});

The budget_tokens parameter lets you control how much reasoning Claude can use. Higher budgets allow deeper exploration but cost more.

Step 3: Structure Prompts for Deep Reasoning

Prompt template optimized for extended thinking Design prompts that encourage systematic exploration and analysis

Extended thinking works best with prompts that explicitly request thorough analysis:

Standard prompt:

Should we use Postgres or MongoDB?

Extended thinking prompt:

Analyze whether we should use Postgres or MongoDB for our application.

Context:
- User data: 10M records, relational structure
- Product catalog: 500K items, nested attributes
- Transaction volume: 10K writes/day
- Query patterns: Complex joins, full-text search
- Team expertise: Strong SQL, limited NoSQL

Consider:
1. Performance characteristics for our specific use case
2. Scalability implications at 10x growth
3. Development velocity impact
4. Operational complexity
5. Cost implications
6. Lock-in risks

Think through each factor systematically and provide a recommendation with clear reasoning.

The detailed prompt gives Claude a framework for systematic exploration.

Step 4: Review the Thinking Process

Extended thinking reasoning output Claude exposes its reasoning process so you can verify the logic

Extended thinking responses include both the thinking process and the final answer. Review the thinking to understand how Claude reached its conclusion:

Thinking:
Let me work through this systematically...

1. Performance analysis:
   - Postgres: Excellent for joins, strong ACID guarantees
   - MongoDB: Better for nested documents, but joins are awkward
   - For 10M user records with relationships, Postgres advantage
   
2. Scalability considerations:
   - Postgres: Vertical scaling easier, horizontal requires care
   - MongoDB: Horizontal scaling built-in, but complexity at scale
   - At 100M users, both viable with proper architecture
   
3. Development velocity:
   - Team knows SQL well - lower learning curve for Postgres
   - MongoDB schema flexibility attractive but risky without discipline
   - Time to market advantage: Postgres
...

Final answer:
I recommend Postgres for your use case. While MongoDB's flexibility is appealing...

This transparency lets you verify the reasoning and spot flawed assumptions.

Step 5: Use Extended Thinking for Code Review

Code review with extended thinking analysis Extended thinking catches subtle bugs and architectural issues in code review

Code review is a perfect use case for extended thinking. Instead of pattern-matching to common issues, Claude can deeply analyze logic:

// Review this authentication middleware thoroughly
async function authMiddleware(req, res, next) {
  const token = req.headers.authorization?.split(' ')[1];
  
  if (!token) {
    return res.status(401).json({ error: 'No token provided' });
  }
  
  try {
    const decoded = jwt.verify(token, process.env.JWT_SECRET);
    req.user = await User.findById(decoded.userId);
    
    if (!req.user) {
      return res.status(401).json({ error: 'User not found' });
    }
    
    next();
  } catch (error) {
    return res.status(401).json({ error: 'Invalid token' });
  }
}

With extended thinking prompt:

Review this authentication middleware for security issues, edge cases, and best practices.

Consider:
- Security vulnerabilities
- Error handling completeness
- Performance implications
- Edge cases and race conditions
- Best practice violations
- Production readiness

Think through each aspect carefully.

Extended thinking catches issues like: missing rate limiting, potential timing attacks, database query in hot path, inconsistent error messages leaking information.

Step 6: Apply to Strategic Business Analysis

Strategic business analysis with extended thinking Use extended thinking for business strategy and high-stakes decisions

For strategic decisions, extended thinking explores tradeoffs more thoroughly:

Analyze whether we should build our own ML infrastructure or use a managed service.

Context:
- Current: Using OpenAI API, $15K/month
- ML team: 2 engineers, both experienced
- Infrastructure budget: $100K/year available
- Use case: Customer support classification, 1M requests/month
- Growth: 3x expected next year

Consider:
- Total cost of ownership (build vs buy)
- Time to production value
- Flexibility and control
- Talent acquisition needs
- Risk factors
- Strategic positioning

Explore multiple scenarios and provide a recommendation.

Extended thinking produces a multi-dimensional analysis that considers both immediate and long-term implications.

Step 7: Optimize Thinking Budget Allocation

Thinking budget optimization chart Balance thinking depth against cost and latency requirements

The budget_tokens parameter controls how much Claude can "think." Optimize this for your use case:

Low budget (500-1000 tokens):

  • Quick but still thoughtful responses
  • Good for medium-complexity tasks
  • ~2-3x standard response time

Medium budget (1000-2000 tokens):

  • Thorough exploration of alternatives
  • Most common use case
  • ~3-5x standard response time

High budget (2000-4000 tokens):

  • Deep, systematic analysis
  • For critical decisions only
  • ~5-10x standard response time

Unlimited budget (no limit):

  • Claude decides when to stop thinking
  • Most thorough but unpredictable cost
  • Use for highest-stakes decisions

Test different budgets to find the sweet spot for your use cases.

Step 8: Combine with Chain-of-Thought Prompting

Extended thinking plus chain-of-thought diagram Combine extended thinking with explicit chain-of-thought instructions for maximum depth

Extended thinking and chain-of-thought prompting are complementary. Extended thinking gives Claude time to think; CoT tells it how to structure that thinking:

Problem: Design a caching strategy for our API.

Use this reasoning framework:
1. Identify what data to cache (frequency, size, volatility)
2. Choose caching layer (CDN, Redis, application)
3. Define invalidation strategy
4. Consider edge cases (cache stampede, stale data)
5. Estimate resource requirements
6. Plan monitoring and alerting

Work through each step systematically, considering our constraints:
- 100K API requests/day
- 80% read, 20% write
- Average response payload: 50KB
- Current p95 latency: 250ms
- Target: 100ms p95

Think deeply about each step before moving to the next.

This combines extended thinking's depth with CoT's structure for maximum quality.

Step 9: Handle Extended Thinking in Production

Production system using extended thinking selectively Build systems that use extended thinking strategically for high-value requests

In production, route requests intelligently:

async function routeRequest(query, context) {
  const complexity = assessComplexity(query);
  const urgency = assessUrgency(context);
  
  if (complexity === 'high' && urgency === 'low') {
    // Use extended thinking
    return await claudeAPI.query({
      prompt: query,
      thinking: { type: 'enabled', budget_tokens: 2000 }
    });
  } else if (complexity === 'medium') {
    // Light extended thinking
    return await claudeAPI.query({
      prompt: query,
      thinking: { type: 'enabled', budget_tokens: 500 }
    });
  } else {
    // Standard mode
    return await claudeAPI.query({
      prompt: query,
      thinking: { type: 'disabled' }
    });
  }
}

This balances quality against cost and latency based on actual request characteristics.

Step 10: Monitor Thinking Effectiveness

Analytics dashboard showing extended thinking performance Track whether extended thinking produces better outcomes for your use cases

Measure extended thinking's impact:

async function analyzeThinkingEffectiveness() {
  const results = await db.query(`
    SELECT 
      thinking_enabled,
      AVG(user_rating) as avg_rating,
      AVG(revision_count) as avg_revisions,
      AVG(token_cost) as avg_cost,
      AVG(response_time_ms) as avg_latency
    FROM api_requests
    WHERE created_at > NOW() - INTERVAL '30 days'
    GROUP BY thinking_enabled
  `);
  
  return {
    quality_improvement: calculateImprovement(results),
    cost_increase: calculateCostDelta(results),
    latency_impact: calculateLatencyDelta(results),
    roi: calculateROI(results)
  };
}

Track:

  • Output quality (user ratings, revisions needed)
  • Cost increase (tokens consumed)
  • Latency impact (response time)
  • Overall ROI (quality improvement vs cost)

If extended thinking doesn't measurably improve outcomes for a use case, disable it.

Advanced: Streaming Extended Thinking

Streaming interface showing thinking in real-time Stream thinking process in real-time for interactive experiences

For interactive applications, stream the thinking process:

const stream = await anthropic.messages.stream({
  model: 'claude-opus-4',
  thinking: { type: 'enabled' },
  messages: [{ role: 'user', content: query }]
});

stream.on('thinking', (chunk) => {
  // Display thinking as it happens
  displayThinking(chunk.text);
});

stream.on('message', (chunk) => {
  // Display final response
  displayResponse(chunk.text);
});

This creates transparency—users see Claude "working" on their problem, which builds trust and sets expectations for complex queries.

Conclusion

Extended thinking use case decision matrix Use extended thinking strategically for complex, high-value reasoning tasks

Extended thinking transforms Claude from a fast pattern-matcher into a deliberate reasoner. For complex problems—strategic decisions, deep code review, nuanced analysis—the additional thinking time produces measurably better outcomes. The key is using it strategically: not every query needs deep reasoning, but the ones that do benefit dramatically.

Start by identifying your highest-value, most complex tasks. Enable extended thinking for those and measure the impact. As you learn which use cases benefit most, refine your routing logic to apply extended thinking selectively. The result is higher-quality outputs where it matters most without unnecessary cost on simple queries.

For more Claude optimization strategies, explore our guides on advanced prompt engineering, Claude system prompts, and prompt chaining workflows. The Anthropic API documentation covers additional extended thinking features and best practices.

Ready to unlock deeper reasoning? Try extended thinking on your next complex code review or strategic analysis—the quality improvement will be immediately obvious.