The Model ID Change
Claude Sonnet 4 ships as `claude-sonnet-4-5` in the API (the numbering reflects internal iterations). If you are pinning a specific model ID in your agent code, update it. The previous `claude-3-7-sonnet` line still works but routes to an older generation.
Extended Thinking
Sonnet 4 makes extended thinking available on most requests, not just on demand. The model reasons through a problem before giving the final answer. For agent tasks this matters because multi-step reasoning is more reliable.
For agent developers, the change is that thinking tokens appear in the API response as a separate content block. Your parsing code needs to handle the new block type:
1 for (const block of response.content) { 2 if (block.type === "thinking") { 3 // reasoning trace, not the final answer 4 continue; 5 } 6 if (block.type === "text") { 7 // final output 8 processOutput(block.text); 9 } 10 }
Improved Tool Calling Accuracy
The biggest practical change: Sonnet 4 calls tools correctly more often. In earlier models, tool arguments would sometimes be malformed JSON or the wrong schema. Sonnet 4 validates against the schema before calling.
This means you can reduce defensive parsing in your tool handlers. You still need to validate inputs, but you see fewer format errors.
Interleaved Thinking in Tool Results
Sonnet 4 supports thinking between tool calls in an agent loop. The model can reason about a tool result before deciding what to call next. This improves multi-step tasks where each step depends on the previous result.
You do not need to change your tool loop code. The model handles this internally. What you will notice is fewer "I need to use X tool" dead ends where the model loops without making progress.
What Has Not Changed
The tool calling API shape is the same. Your existing tool definitions work without changes. Context window is the same. Pricing is similar to Sonnet 3.7. The system prompt format has not changed.
Comments (0)