{"version":"2.0.1","anchor":"extended-thinking-detection-for-api-calls","canonical_anchor":"extended-thinking-detection-for-api-calls","heading":"Extended Thinking Detection for API Calls","tier":null,"area":null,"scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.0.1\/e\/extended-thinking-detection-for-api-calls","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.0.1","markdown":"### Extended Thinking Detection for API Calls\n\n**What:** Added automatic detection of extended thinking content in conversation history to ensure accurate token counting and proper API parameter configuration.\n\n**How it works:** When Claude Code needs to count tokens for API calls, it now scans through the message history to detect if any assistant responses contain thinking or redacted_thinking blocks. If detected, it automatically includes the appropriate thinking parameters in the API call.\n\n**Details:**\n\n- Detects both `thinking` and `redacted_thinking` content types\n- Automatically adjusts token counting for conversations with extended thinking\n- Ensures API calls include proper thinking budget parameters (1024 tokens)\n- Improves accuracy when estimating costs for conversations using extended thinking\n- **Evidence**: `uS2() at line 376194` (new detection function), enhanced `TZ1() at line 376212` and `dS2() at line 376234`"}