You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched existing issues and this hasn't been reported yet
This is a single bug report (please file separate reports for different bugs)
I am using the latest version of Claude Code
What's Wrong?
When using Haiku 4.5 (claude-haiku-4-5-20251001) in lengthy conversations that require summarization/compacting, Claude Code throws an error indicating that the output exceeded the 8192 token maximum:
API Error: Claude's response exceeded the 8192 output token maximum. To configure this behavior, set the CLAUDE_CODE_MAX_OUTPUT_TOKENS environment variable.
The 8,192 token limit is the correct limit for Haiku 3.5 (claude-3-5-haiku-20241022), not Haiku 4.5.
What Should Happen?
Haiku 4.5 should use its correct maximum output token limit of 64,000 tokens, as specified in the official Anthropic documentation.
Error Messages/Logs
API Error: Claude's response exceeded the 8192 output token maximum. To configure this behavior, set the CLAUDE_CODE_MAX_OUTPUT_TOKENS environment variable.
This error occurs during conversation summarization/compacting after a lengthy enough conversation with Haiku 4.5.
Steps to Reproduce
Select Haiku 4.5 as your model using /model command
Have a lengthy conversation that requires multiple turns
Continue until the conversation is long enough to trigger automatic summarization/compacting
Observe the error when Claude's summarization response exceeds 8192 tokens
Technical Analysis
Based on investigation of issue #4255, the root cause appears to be in the model detection logic that determines output token limits:
functionAL0(A){if(A.includes("3-5"))return8192;if(A.includes("haiku"))return8192;// ← Bug: This catches ALL Haiku models// ...return32000}
The current logic uses a simple string check if(A.includes("haiku"))return 8192; which matches ANY model name containing "haiku", including:
❌ claude-haiku-4-5-20251001 → incorrectly returns 8192 (should be 64000)
Environment variable ANTHROPIC_DEFAULT_HAIKU_MODEL can be used for manual override
Claude Model
Haiku 4.5
Is this a regression?
No, this never worked
Last Working Version
N/A - Haiku 4.5 support is new in v2.0.17
Claude Code Version
2.0.17+ (latest version with Haiku 4.5 support)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
Impact: This bug significantly limits Haiku 4.5's usefulness for long conversations or complex tasks that require substantial output, as it incorrectly enforces the Haiku 3.5 token limit instead of the actual 64K limit.
Workaround: Currently, there's no effective workaround besides:
Switching to a different model (Sonnet 4.5 has 64K output)
Note: Setting CLAUDE_CODE_MAX_OUTPUT_TOKENS=64000 won't work as a workaround because it gets rejected with validation error, and even if it didn't, the model-specific check happens first in the code logic.
Preflight Checklist
What's Wrong?
When using Haiku 4.5 (
claude-haiku-4-5-20251001) in lengthy conversations that require summarization/compacting, Claude Code throws an error indicating that the output exceeded the 8192 token maximum:However, according to Anthropic's model comparison table, Haiku 4.5 has a 64,000 token max output, not 8,192 tokens.
The 8,192 token limit is the correct limit for Haiku 3.5 (
claude-3-5-haiku-20241022), not Haiku 4.5.What Should Happen?
Haiku 4.5 should use its correct maximum output token limit of 64,000 tokens, as specified in the official Anthropic documentation.
Error Messages/Logs
This error occurs during conversation summarization/compacting after a lengthy enough conversation with Haiku 4.5.
Steps to Reproduce
/modelcommandTechnical Analysis
Based on investigation of issue #4255, the root cause appears to be in the model detection logic that determines output token limits:
The current logic uses a simple string check
if(A.includes("haiku"))return 8192;which matches ANY model name containing "haiku", including:claude-haiku-4-5-20251001→ incorrectly returns 8192 (should be 64000)claude-3-5-haiku-20241022→ correctly returns 8192claude-3-haiku-20240307→ correctly returns 8192 (though docs say 4096)Suggested Fix
Update the model detection logic to check for Haiku 4.5 specifically before the generic Haiku check:
Alternatively, use more specific model name matching to avoid future issues with new model releases.
Reference Documentation
Model Output Token Limits (from Anthropic docs):
claude-haiku-4-5-20251001): 64,000 tokensclaude-3-5-haiku-20241022): 8,192 tokensclaude-3-haiku-20240307): 4,096 tokensRelated Context:
ANTHROPIC_DEFAULT_HAIKU_MODELcan be used for manual overrideClaude Model
Haiku 4.5
Is this a regression?
No, this never worked
Last Working Version
N/A - Haiku 4.5 support is new in v2.0.17
Claude Code Version
2.0.17+ (latest version with Haiku 4.5 support)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
Impact: This bug significantly limits Haiku 4.5's usefulness for long conversations or complex tasks that require substantial output, as it incorrectly enforces the Haiku 3.5 token limit instead of the actual 64K limit.
Workaround: Currently, there's no effective workaround besides:
CLAUDE_CODE_MAX_OUTPUT_TOKENSenvironment variable (though this is capped at 32K per [BUG] Invalid env var CLAUDE_CODE_MAX_OUTPUT_TOKENS #4255)Note: Setting
CLAUDE_CODE_MAX_OUTPUT_TOKENS=64000won't work as a workaround because it gets rejected with validation error, and even if it didn't, the model-specific check happens first in the code logic.