Extended thinking mode
Claude 3.7 Sonnet and Claude 4.0 Sonnet support an Extended Thinking mode that allows you to tailor responses to either generate concise summarizations or detailed, critical reasoning processes.
This mode allows Claude to output the reasoning process used to generate a final response. This feature is useful for complex tasks that require structured analysis. The reasoning process is included in the API response.
You may apply Extended Thinking mode in these use cases:
-
Complex analysis that involves multiple parameters and factors.
-
Advanced STEM tasks such as mathematics, research, or development.
-
Processing long context inputs.
-
Structured creative writing that requires detailed planning and coordination of narrative elements.
Note: Using the Extended Thinking mode may increase response times.
You can test the Extended Thinking mode in LLM Passthrough API endpoints.
Note: To enable the Extended Thinking mode, set the
"reasoning": "enabled" to true.
Note:
Budget_tokens value cannot exceed the max_response tokens value.
Payload for api/v1/messages endpoint
{
"system": "You are a math professor, you help people answer math questions.",
"model": "CLAUDE",
"version": "claude-3-7-sonnet-20250219-v1:0",
"config": {
"max_response": 8192,
"reasoning": {
"enabled": true,
"budget_tokens": 4096
}
},
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"data": "What is your favorite algorithm?"
},
{
"type": "text",
"data": "Can you tell me yours first?."
}
]
},
{
"role": "assistant",
"content": [
{
"type": "text",
"data": "Can you tell me yours first?."
}
]
},
{
"role": "user",
"content": [
{
"type": "text",
"data": "But I asked first"
}
]
}
]
}
Payload for api/v1/prompt endpoint
{
"model": "CLAUDE",
"version": "claude-3-7-sonnet-20250219-v1:0",
"config": {
"max_response": 16000,
"reasoning": {
"enabled": true,
"budget_tokens": 8000
}
},
"prompt": "<system>You are a healthcare provider explaining treatment options to a patient.</system><statement>Antibiotics are a type of drug used to treat bacterial infections. They work by killing bacteria or preventing them from reproducing, allowing the body's immune system to fight the infection. Antibiotics are usually taken orally in the form of pills, capsules or liquid solutions, or sometimes given intravenously. They are not effective against viral infections, and their inappropriate use can lead to antibiotic resistance.</statement><user>Explain the above statement as if you are talking to a patient.</user>"
}