TheDocumentation 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.
providerOptions method provides an escape hatch for Anthropic API parameters that the PHP AI SDK does not explicitly model. Any key placed inside the raw array is merged directly into the final request body sent to the Anthropic API using array_replace, giving you access to the full surface of the Anthropic Messages API without waiting for first-class SDK support.
Basic Usage
Pass araw array under the 'anthropic' provider key. Every entry inside raw is shallow-merged into the request body immediately before the HTTP request is dispatched.
Supported Raw Parameters
The following are examples of Anthropic API parameters you can forward throughraw. Any field accepted by the Anthropic Messages API can be used here.
| Parameter | Type | Description |
|---|---|---|
top_k | int | Sample from the top K options for each subsequent token. Reduces randomness at lower values. |
stop_sequences | array | An array of custom strings that will halt generation when encountered. |
metadata | array | An object describing the end user making the request, used by Anthropic for abuse prevention. Pass metadata.user_id to identify individual users. |
Override Behavior
Becausearray_replace is used, keys present in raw overwrite any field that was already set in the request body by the SDK. This applies to every field, including model, temperature, max_tokens, messages, and stream.
Relationship to Headers
raw and headers serve different purposes and operate at different layers of the request:
raw— merges keys into the request body (JSON payload). Use it for API parameters such astop_k,stop_sequences, andmetadata.headers— adds or overrides HTTP request headers. Configure these inAnthropic::create().
anthropic-beta: extended-thinking-2025-05-14) — use the headers config option, not raw:
raw will place it in the request body, where Anthropic ignores it.