Thinking mode allows supported models to show their reasoning process before providing the final answer. This feature is currently available for select models like Claude Sonnet 4.
To enable thinking mode, add the thinking parameter to your request:
Copy
payload = { "model": "claude-sonnet-4-20250514", "max_tokens": 16000, "thinking": { "type": "enabled", "budget_tokens": 10000 }, "messages": [ { "role": "user", "content": "Are there an infinite number of prime numbers such that n mod 4 == 3?" } ]}
When thinking is enabled, the response will include additional fields showing the model’s reasoning process. See the Log Thinking documentation for details on the response structure.