Documentation 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.
AnthropicOptions is a final, immutable value object holding all configuration for the Anthropic provider. Every public property is declared readonly, so the object cannot be mutated after construction. Create one via the fromArray() static factory — which handles environment variable fallbacks — or directly via the constructor when you have all values at hand.
Constants
'https://api.anthropic.com/v1' — The default base URL used for all API requests when no override is provided.'2023-06-01' — The default value sent as the anthropic-version request header.'anthropic' — The canonical provider name string returned by AnthropicProvider::name() and used to scope model registry entries.Constructor Parameters
readonly public properties of the same name.
Your Anthropic API key. Sent as the
x-api-key HTTP header on every request. Must be a non-empty string — the SDK throws if it is missing and the ANTHROPIC_API_KEY environment variable is also absent.Base URL for API requests. Any trailing slash is stripped automatically by
fromArray(). Override this when pointing at a proxy, a local mock server, or a compatible third-party endpoint.Anthropic API version string. Sent as the
anthropic-version header on every request. Change this only if Anthropic instructs you to use a different version.Additional HTTP headers merged into every request after the authentication headers. Useful for Anthropic beta feature flags such as
'anthropic-beta' => 'extended-thinking-2025-05-14'. Custom headers are merged last, so they can override the default auth headers if keys collide.Optional
Sdk instance wrapping a PSR-18 HTTP client, PSR-17 request factory, and PSR-17 stream factory. Inject a custom Sdk to control transport behaviour — for example to supply a mock HTTP client in tests or to configure timeouts and middleware.fromArray()
AnthropicOptions instance. Reads apiKey, baseUrl, version, headers, and sdk from the supplied array, falling back to environment variables for the first three when the corresponding key is absent or null.
| Array key | Environment variable fallback | Default value |
|---|---|---|
apiKey | ANTHROPIC_API_KEY | (required) |
baseUrl | ANTHROPIC_BASE_URL | https://api.anthropic.com/v1 |
version | ANTHROPIC_VERSION | 2023-06-01 |
headers | — | [] |
sdk | — | null |
When
apiKey is omitted from the array and ANTHROPIC_API_KEY is not set in the environment, fromArray() throws an exception. Always ensure at least one of these is present before creating a provider.authHeaders()
AnthropicTextModel.