[BUG] The word "think" forces a call to Sonnet, causing an API error if the environment is set to use Haiku
Bug Description
Prompting Claude Code in a way that elicits thinking throws an API error if you have put haiku-3.5 (claude-3-5-haiku-20241022) as the env ANTHROPIC_MODEL value. Even if you say "Don't think at all... etc." (In fact, it seems like the very word "thinking" triggers a call to Sonnet.) This appears to be different than Claude.ai - if I select 3.5-haiku on Claude.ai chat, I can tell it "think as hard as you possibly can... etc." and it will not error out (it won't perform reasoning because of the model but that's expected). Same with the API. To me this is a bug. You should be able to prompt Claude to do something it can't do, and it should reply that it can't do it, rather than error out. This seems like a special feature of the design of Claude Code. For instance, consider this exchange:
Use your powers of seeing into the future and tell me the price of Bitcoin in USD 24 hours from now
- I apologize, but I cannot predict future cryptocurrency prices. Predicting financial markets involves complex factors that are impossible to forecast with certainty. If you're interested in Bitcoin's current value, I recommend checking reliable financial websites or cryptocurrency exchanges for real-time pricing information.
COMPARED TO:
Tell me what you think the price of Bitcoin will be in USD 24 hours from now. ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"'claude-3-5-haiku-20241022' does not support thinking."}}
AND COMPARED TO:
Tell me what you predict the price of Bitcoin will be in USD 24 hours from now.
I do not make financial predictions or speculate on cryptocurrency prices. Attempting to forecast market values would be irresponsible and potentially misleading. If you're interested in Bitcoin's value, I recommend consulting financial experts, market analysts, or reputable financial information sources.
The word "think" seems to be an automatic trigger to call Sonnet, which seems restrictive and in some cases outright silly:
I hate thinking. What is today's date? ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"'claude-3-5-haiku-20241022' does not support thinking."}}
I hate cogitating about anything. What is today's date?
3/30/2025
I think it would be cool to tell me a joke. ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"'claude-3-5-haiku-20241022' does not support thinking."}}
can you help me design a complicated software project in python? i want to build a chatbot with RAG capability, prompt caching, and an agentic workflow. write a
brief overview of the necessary components in 10 bullet points or less.
* I'll help you design a RAG chatbot project. Based on the project context and best practices, here's a brief overview:
1. LangGraph for agentic workflow with defined nodes for retrieval, generation, and tool use
2. Vector database (e.g., Chroma or Pinecone) for efficient context retrieval
3. Streamlit for interactive UI with model selection and configuration tabs
4. Prompt caching mechanism using LRU cache or Redis for performance optimization
5. TypedDict for robust state management across graph nodes
6. Error handling decorator for graceful node failure management
7. Environment variable configuration for API keys and model settings
8. Logging infrastructure for tracking token usage and debugging
9. Pre-commit hooks for code quality (ruff, mypy)
10. Modular architecture supporting multiple LLM providers
Would you like me to elaborate on any of these components?
> I don't think so.
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"'claude-3-5-haiku-20241022' does not support thinking."}}
Environment Info
- Platform: macos
- Terminal: Apple_Terminal
- Version: 0.2.56
- Feedback ID: eaabd4d7-8bfb-4ef3-826a-804f01703aeb
Errors
[{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"'claude-3-5-haiku-20241022' does not support thinking.\"}}\n at H6.generate (file:///Users/hesreallyhim/.nvm/versions/node/v20.15.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1054:10176)\n at $6.makeStatusError (file:///Users/hesreallyhim/.nvm/versions/node/v20.15.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1058:7207)\n at $6.makeRequest (file:///Users/hesreallyhim/.nvm/versions/node/v20.15.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1058:8149)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-03-30T18:36:30.565Z"}]
Here's another good one:
how do you spell the word "think" ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"'claude-3-5-haiku-20241022' does not support thinking."}}
Claude introduce a new STOP word in the our GAME THINK:
> think
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.43.content.0.type: Expected `thinking` or
`redacted_thinking`, but found `text`. When `thinking` is enabled, a final `assistant` message must start with a thinking block (preceeding
the lastmost set of `tool_use` and `tool_result` blocks). We recommend you include thinking blocks from previous turns. To avoid this
requirement, disable `thinking`. Please consult our documentation at https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking"}}
Claude introduce a new STOP word in the our GAME THINK:
> think ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.43.content.0.type: Expected `thinking` or `redacted_thinking`, but found `text`. When `thinking` is enabled, a final `assistant` message must start with a thinking block (preceeding the lastmost set of `tool_use` and `tool_result` blocks). We recommend you include thinking blocks from previous turns. To avoid this requirement, disable `thinking`. Please consult our documentation at https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking"}}
that's great 😄