Claude supports extended thinking viaDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/phpaisdk/anthropic/llms.txt
Use this file to discover all available pages before exploring further.
thinking content blocks. When reasoning is enabled, Claude performs additional internal reasoning before producing its final response. The PHP AI SDK exposes this through Reasoning::effort(), which the Anthropic provider converts to a budget_tokens value and sends in the thinking field of the request body.
Basic Usage
AttachReasoning::effort() to a generation request. The effort level controls how many tokens Claude is allowed to spend on its internal reasoning chain.
'low', 'medium', and 'high'. Each maps to a percentage band of the model’s configured max_tokens.
Budget Calculation
AnthropicReasoningBudget calculates the token budget from the effort level and the request’s max_tokens value:
The smallest token budget the Anthropic API accepts. Calculated budgets below this floor are clamped to
1024.When no effort-specific percentage applies, the budget defaults to 30 % of
max_tokens.The calculated budget must be strictly less than
max_tokens. The Anthropic API rejects requests where budget_tokens >= max_tokens.thinking field sent to the API looks like this:
Response
When thinking is enabled, the API may return one or morethinking content blocks alongside the usual text blocks. The response parser maps them as follows:
| Anthropic block type | SDK response part |
|---|---|
text | TextPart |
thinking | ReasoningPart |
$result->parts. You can inspect reasoning content separately from the main text:
Beta Header
Some Claude models require theanthropic-beta: extended-thinking-2025-05-14 header to enable thinking blocks. Pass it via the headers option when creating the provider:
Reasoning requires a Claude model that supports it (e.g.,
claude-sonnet-4, claude-opus-4, claude-3-7-sonnet). Check $model->supports(Capability::Reasoning) before enabling it to avoid sending unsupported requests.