Are you an LLM? You can read better optimized documentation at /api/@nhtio/adk/batteries/llm/anthropic_messages/types/interfaces/AnthropicMessagesAdapterOptions.md for this page in Markdown format
Interface: AnthropicMessagesAdapterOptions
Defined in: src/batteries/llm/anthropic_messages/types.ts:359
Configuration options for the Anthropic Messages adapter.
Properties
| Property | Type | Default value | Description | Defined in |
|---|---|---|---|---|
apiKey? | string | undefined | API key used by the Anthropic SDK. Omit only when another SDK credential source is intended. | src/batteries/llm/anthropic_messages/types.ts:361 |
autoAck? | boolean | undefined | Whether the executor acks automatically on a tool-call-free terminal answer. | src/batteries/llm/anthropic_messages/types.ts:437 |
baseURL? | string | undefined | Endpoint base URL. Defaults to the Anthropic SDK default unless overridden. | src/batteries/llm/anthropic_messages/types.ts:363 |
bucketOrder? | ChatCompletionsBucketOrder | undefined | Determines order of system-prompt content buckets in history assembly. | src/batteries/llm/anthropic_messages/types.ts:421 |
cacheBreakpoints? | AnthropicCacheBreakpoints | undefined | Prompt-cache breakpoint placement mode. | src/batteries/llm/anthropic_messages/types.ts:455 |
cacheTtl? | AnthropicCacheTtl | undefined | Optional TTL applied to emitted prompt-cache breakpoints. | src/batteries/llm/anthropic_messages/types.ts:457 |
container? | string | null | undefined | Anthropic container identifier for container-capable tools. | src/batteries/llm/anthropic_messages/types.ts:463 |
contextWindow? | number | undefined | Size of the model's token context window for the ADK guard. | src/batteries/llm/anthropic_messages/types.ts:423 |
dangerouslyAllowBrowser? | boolean | undefined | Allows Anthropic SDK use in browser-like runtimes despite API-key exposure risk. | src/batteries/llm/anthropic_messages/types.ts:453 |
fetch? | { (input: URL | RequestInfo, init?: RequestInit): Promise<Response>; (input: string | URL | Request, init?: RequestInit): Promise<Response>; } | undefined | Custom fetch implementation, used for tests, proxies, or custom transports. | src/batteries/llm/anthropic_messages/types.ts:367 |
headers? | Record<string, string> | undefined | Custom HTTP headers sent with every request. | src/batteries/llm/anthropic_messages/types.ts:365 |
helpers? | Partial<AnthropicMessagesHelpers> | undefined | Optional overrides for Anthropic translation helpers. | src/batteries/llm/anthropic_messages/types.ts:433 |
inferenceGeo? | string | null | undefined | Anthropic inference geography selector. | src/batteries/llm/anthropic_messages/types.ts:465 |
localToolCallParser? | | ToolCallParserName | ToolCallParserFn | undefined | Optional fallback parser for non-structural local tool-call text. | src/batteries/llm/anthropic_messages/types.ts:494 |
maxTokens | number | undefined | Required maximum number of output tokens to request from Anthropic. | src/batteries/llm/anthropic_messages/types.ts:443 |
metadata? | Metadata | undefined | Anthropic request metadata. | src/batteries/llm/anthropic_messages/types.ts:459 |
model | Model | undefined | Required Anthropic model identifier. | src/batteries/llm/anthropic_messages/types.ts:441 |
onPromptAssembled? | PromptAssembledObserverFn | undefined | Observe the fully assembled Anthropic request before dispatch. | src/batteries/llm/anthropic_messages/types.ts:492 |
onRawGeneration? | RawGenerationObserverFn | undefined | Observe the model's raw response for each completed generation. | src/batteries/llm/anthropic_messages/types.ts:490 |
outputConfig? | OutputConfig | undefined | Structured-output and effort configuration sent to Anthropic. | src/batteries/llm/anthropic_messages/types.ts:449 |
replayCompatibility? | readonly string[] | undefined | List of replay labels supported by this adapter. | src/batteries/llm/anthropic_messages/types.ts:431 |
requestTimeoutMs? | number | undefined | Request timeout in milliseconds for API calls. | src/batteries/llm/anthropic_messages/types.ts:373 |
resolveErrorStatus? | AnthropicMessagesErrorStatusResolver | undefined — no recovery; a statusless APIError stays fatal, preserving the behaviour of adapters built before this hook existed. | Recovers an HTTP status the Anthropic SDK could not observe, so retry classification can see it. Remarks Unlike the Ollama and OpenAI batteries — which read response.status off a raw fetch and therefore always see the real code — this battery classifies from the SDK's APIError. When a gateway terminates the HTTP request itself and reports the upstream failure inside the response body, err.status is absent, is coerced to 0, matches nothing in @nhtio/adk/batteries/llm/chat_common!ChatCompletionsRetryConfig.retriableStatuses, and the error is classified fatal — so a transient upstream 529 overloaded_error fails on first occurrence with retry never consulted. The ADK deliberately ships no body parser: the shape of a gateway's error envelope is the consumer's knowledge, not the ADK's, and guessing it with a built-in regex risks reading a three-digit request id — or a genuine deterministic 4xx — as a retriable status. This hook is the seam for a consumer who does know their gateway. Called only for SDK APIErrors, before retriable/fatal classification and before the context-overflow body-text check. Return an HTTP status to classify against, or undefined to decline — declining leaves sdkStatus in force, so a resolver that does not recognise a body is a no-op rather than a hazard. A returned value outside 100–599 is ignored with a warning. The resolved status is what reaches retriableStatuses, the E_ANTHROPIC_MESSAGES_HTTP_ERROR payload, and the log line — so a recovered 529 is reported as 529, not 0. Must not throw; a throwing resolver is caught, warned about, and treated as declining. Example new AnthropicMessagesAdapter({ model, maxTokens, retry: { maxAttempts: 4 }, // This gateway reports the upstream status in the body and nowhere else. resolveErrorStatus: ({ bodyText, sdkStatus }) => { if (sdkStatus !== 0) return undefined const m = /upstream returned (\d{3})/.exec(bodyText) return m ? Number(m[1]) : undefined }, }) | src/batteries/llm/anthropic_messages/types.ts:419 |
retry? | ChatCompletionsRetryConfig | undefined | Configures ADK-owned request retry behavior. | src/batteries/llm/anthropic_messages/types.ts:375 |
selfIdentity? | string | undefined | Unique identity label for the assistant instance. | src/batteries/llm/anthropic_messages/types.ts:425 |
serviceTier? | "auto" | "standard_only" | undefined | Anthropic service-tier selector. | src/batteries/llm/anthropic_messages/types.ts:461 |
spoolStore? | SpoolStore | undefined | Backing store for string or bytes tool returns. | src/batteries/llm/anthropic_messages/types.ts:435 |
stopSequences? | string[] | undefined | Custom stop sequences sent as stop_sequences. | src/batteries/llm/anthropic_messages/types.ts:445 |
stream? | boolean | undefined | Whether to stream the response as Anthropic stream events. | src/batteries/llm/anthropic_messages/types.ts:369 |
streamIdleTimeoutMs? | number | undefined | Idle timeout in milliseconds for the stream before aborting. | src/batteries/llm/anthropic_messages/types.ts:371 |
temperature? | number | undefined | Deprecated Anthropic temperature sampling parameter. Deprecated Models released after Claude Opus 4.6 reject most values with a 400. The adapter never supplies this unless the caller sets it. | src/batteries/llm/anthropic_messages/types.ts:474 |
thinking? | ThinkingConfigParam | undefined | Extended or adaptive thinking configuration sent to Anthropic. | src/batteries/llm/anthropic_messages/types.ts:447 |
thoughtSurfacing? | "all" | "all-self" | "latest-self" | undefined | Determines which thoughts are surfaced back to the model. | src/batteries/llm/anthropic_messages/types.ts:427 |
tokenEncoding? | | TokenEncodingId | null | undefined | Tokenizer encoding configuration for token counting. | src/batteries/llm/anthropic_messages/types.ts:429 |
toolCallIdFilter? | ToolCallIdFilterFn | undefined | Optional ingress hook for adapting provider tool-call ids; absent preserves the vendor id. | src/batteries/llm/anthropic_messages/types.ts:496 |
toolChoice? | ToolChoice | undefined | Tool-choice directive sent to Anthropic. | src/batteries/llm/anthropic_messages/types.ts:451 |
topK? | number | undefined | Deprecated Anthropic top-k sampling parameter. Deprecated Models released after Claude Opus 4.6 reject every value with a 400. The adapter never supplies this unless the caller sets it. | src/batteries/llm/anthropic_messages/types.ts:488 |
topP? | number | undefined | Deprecated Anthropic nucleus-sampling parameter. Deprecated Models released after Claude Opus 4.6 reject lower values with a 400. The adapter never supplies this unless the caller sets it. | src/batteries/llm/anthropic_messages/types.ts:481 |
unsupportedMediaPolicy? | UnsupportedMediaPolicy | undefined | Policy for media whose modality the Anthropic Messages wire cannot represent. | src/batteries/llm/anthropic_messages/types.ts:439 |
userProfileId? | string | undefined | Anthropic user-profile request parameter (SDK maps this header param on the wire). | src/batteries/llm/anthropic_messages/types.ts:467 |