AnthropicClient unstable
The AnthropicClient module defines the low-level Effect service for
Anthropic's Messages API. It builds a generated Anthropic HTTP client with
authentication headers, API version headers, response decoding, and error
mapping, then exposes helpers for regular and streaming message requests.
Constructors
Creates an Anthropic client service with the given options.
When to use
Use when you have explicit configuration values and need an Effect that
constructs the Anthropic client service, rather than providing it as a Layer.
Details
The client handles API key authentication via the x-api-key header, API versioning via the anthropic-version
header, error mapping to the unified AiError type, and request/response transformations via AnthropicConfig. It
requires an HttpClient in the context.
See
- layer for providing the client as a
Layerfrom explicit options - layerConfig for providing the client as a
LayerwithConfig-based settings
Signature
declare const make: (...args: [options: Options]) => EffectLayers
Creates a layer for the Anthropic client with the given options.
When to use
Use when you already have explicit Options values, such as an API key or
custom API URL, and want to provide AnthropicClient as a Layer.
See
- make for constructing the client service effectfully
- layerConfig for loading client settings from
Config
Signature
declare function layer(options: Options): Layer<AnthropicClient, never, HttpClient>layerConfig
unstableCreates a layer for the Anthropic client, loading the requisite configuration
via Effect's Config module.
When to use
Use when you want to provide the Anthropic client as a Layer with
configuration loaded from Effect's Config module, such as from environment
variables or a secrets provider.
See
Signature
declare function layerConfig(options?: { readonly apiKey?: Config<Redacted<string> | undefined>; readonly apiUrl?: Config<string>; readonly apiVersion?: Config<string>; readonly transformClient?: (client: HttpClient) => HttpClient;}): Layer<AnthropicClient, ConfigError, HttpClient>Models
Represents an event received from the Anthropic Messages API during a streaming request.
Details
Events include:
message_start: Initial event containing message metadatamessage_delta: Incremental updates to the message (e.g., stop reason)message_stop: Final event indicating the message is completecontent_block_start: Start of a content blockcontent_block_delta: Incremental content updates (text, tool use, etc.)content_block_stop: End of a content blockerror: Error events with type and message
Signature
type MessageStreamEvent = typeof Generated.BetaMessageStartEvent.Type | typeof Generated.BetaMessageDeltaEvent.Type | typeof Generated.BetaMessageStopEvent.Type | typeof Generated.BetaContentBlockStartEvent.Type | typeof Generated.BetaContentBlockDeltaEvent.Type | typeof Generated.BetaContentBlockStopEvent.Type | typeof Generated.BetaErrorResponse.TypeOptions
Configuration for creating an Anthropic client.
When to use
Use when the Anthropic client settings are already available as values and
should be passed directly to make or layer.
Details
These options configure the base Anthropic URL, the x-api-key
authentication header, the anthropic-version header, and an optional
transformation of the underlying HttpClient.
See
- make for constructing an Anthropic client from explicit options
- layer for providing an Anthropic client from explicit options
- layerConfig for loading Anthropic client settings from
Config
Signature
type Options = { readonly apiKey?: Redacted.Redacted<string>; readonly apiUrl?: string; readonly apiVersion?: string; readonly transformClient?: (client: HttpClient.HttpClient) => HttpClient.HttpClient;}Services
AnthropicClient
unstableService tag for the Anthropic client.
When to use
Use when accessing or providing the Anthropic client service through Effect's context.
See
- make for constructing an Anthropic client effectfully
- layer for providing a client from explicit options
- layerConfig for providing a client from
Config
Signature
declare class AnthropicClient extends Shape<"@effect/ai-anthropic/AnthropicClient", Service, this> { constructor(_: never);}Represents the Anthropic client service with methods for the Messages API, including regular and streaming message creation.
Signature
interface Service { readonly client: AnthropicClient; readonly createMessage: (options: { readonly params?: { readonly "anthropic-beta"?: string | readonly Array<string>; readonly "anthropic-user-profile-id"?: string; readonly "anthropic-version"?: string; readonly "anthropic-workspace-id"?: string; }; readonly payload: { readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly compaction?: { readonly instructions?: string | null; readonly type: "summarize"; } | null; readonly container?: string | { readonly id?: string | null; readonly skills?: readonly Array<{ readonly skill_id: string; readonly type: "custom" | "anthropic"; readonly version?: string; }> | null; } | null; readonly context_management?: { readonly edits?: readonly Array<{ readonly clear_at_least?: { readonly type: ...; readonly value: ...; } | null; readonly clear_tool_inputs?: boolean | readonly Array<...> | null; readonly exclude_tools?: readonly Array<...> | null; readonly keep?: { readonly type: ...; readonly value: ...; }; readonly trigger?: { readonly type: ...; readonly value: ...; } | { readonly type: ...; readonly value: ...; }; readonly type: "clear_tool_uses_20250919"; } | { readonly keep?: "all" | { readonly type: ...; readonly value: ...; } | { readonly type: ...; }; readonly type: "clear_thinking_20251015"; } | { readonly instructions?: string | null; readonly pause_after_compaction?: boolean; readonly trigger?: { readonly type: ...; readonly value: ...; } | null; readonly type: "compact_20260112"; }>; } | null; readonly diagnostics?: { readonly previous_message_id?: string | null; } | null; readonly fallback_credit_token?: string | { readonly mode?: "strict" | "best_effort"; readonly token: string; } | null; readonly fallbacks?: "default" | readonly Array<{ [key: string]: Json; readonly max_tokens?: number | null; readonly model: string; readonly output_config?: { readonly effort?: "low" | "medium" | "high" | "xhigh" | "max" | null; readonly format?: { readonly schema: { [key: ...]: ...; }; readonly type: "json_schema"; } | null; readonly task_budget?: { readonly remaining?: ... | ... | ...; readonly total: number; readonly type: "tokens"; } | null; } | null; readonly speed?: "standard" | "fast" | null; readonly thinking?: { readonly block_binding?: { readonly prefix_mismatch_behavior?: ... | ... | ... | ...; } | null; readonly budget_tokens: number; readonly display?: "summarized" | "omitted" | "updates" | null; readonly type: "enabled"; } | { readonly type: "disabled"; } | { readonly type: "between_tools"; } | { readonly block_binding?: { readonly prefix_mismatch_behavior?: ... | ... | ... | ...; } | null; readonly display?: "summarized" | "omitted" | "updates" | null; readonly type: "adaptive"; } | null; }> | null; readonly inference_geo?: string | null; readonly max_tokens: number; readonly mcp_servers?: readonly Array<{ readonly authorization_token?: string | null; readonly name: string; readonly tool_configuration?: { readonly allowed_tools?: readonly Array<string> | null; readonly enabled?: boolean | null; } | null; readonly type: "url"; readonly url: string; }>; readonly messages: readonly Array<{ readonly clear_at?: "next_user_message" | "never" | null; readonly content: string | readonly Array<BetaRequestTextBlock | BetaRequestImageBlock | BetaRequestDocumentBlock | BetaRequestSearchResultBlock | BetaRequestThinkingBlock | BetaRequestRedactedThinkingBlock | BetaRequestToolUseBlock | BetaRequestToolResultBlock | { readonly cache_control?: { readonly ttl?: ...; readonly type: ...; } | null; readonly caller?: { readonly type: ...; } | { readonly tool_id: ...; readonly type: ...; } | { readonly tool_id: ...; readonly type: ...; }; readonly id: string; readonly input: { [key: string]: Json; }; readonly name: "advisor" | "web_search" | "web_fetch" | "code_execution" | "bash_code_execution" | "text_editor_code_execution" | "tool_search_tool_regex" | "tool_search_tool_bm25"; readonly type: "server_tool_use"; } | { readonly cache_control?: { readonly ttl?: ...; readonly type: ...; } | null; readonly caller?: { readonly type: ...; } | { readonly tool_id: ...; readonly type: ...; } | { readonly tool_id: ...; readonly type: ...; }; readonly content: readonly Array<...> | { readonly error_code: ...; readonly type: ...; }; readonly tool_use_id: string; readonly type: "web_search_tool_result"; } | { readonly cache_control?: { readonly ttl?: ...; readonly type: ...; } | null; readonly caller?: { readonly type: ...; } | { readonly tool_id: ...; readonly type: ...; } | { readonly tool_id: ...; readonly type: ...; }; readonly content: { readonly error_code: ...; readonly type: ...; } | { readonly content: ...; readonly retrieved_at?: ...; readonly type: ...; readonly url: ...; }; readonly tool_use_id: string; readonly type: "web_fetch_tool_result"; } | { readonly cache_control?: { readonly ttl?: ...; readonly type: ...; } | null; readonly content: { readonly error_code: ...; readonly type: ...; } | { readonly stop_reason?: ...; readonly text: ...; readonly type: ...; } | { readonly encrypted_content: ...; readonly stop_reason?: ...; readonly type: ...; }; readonly tool_use_id: string; readonly type: "advisor_tool_result"; } | { readonly cache_control?: { readonly ttl?: ...; readonly type: ...; } | null; readonly content: { readonly error_code: ...; readonly type: ...; } | { readonly content: ...; readonly return_code: ...; readonly stderr: ...; readonly stdout: ...; readonly type: ...; } | { readonly content: ...; readonly encrypted_stdout: ...; readonly return_code: ...; readonly stderr: ...; readonly type: ...; }; readonly tool_use_id: string; readonly type: "code_execution_tool_result"; } | { readonly cache_control?: { readonly ttl?: ...; readonly type: ...; } | null; readonly content: { readonly error_code: ...; readonly type: ...; } | { readonly content: ...; readonly return_code: ...; readonly stderr: ...; readonly stdout: ...; readonly type: ...; }; readonly tool_use_id: string; readonly type: "bash_code_execution_tool_result"; } | { readonly cache_control?: { readonly ttl?: ...; readonly type: ...; } | null; readonly content: { readonly error_code: ...; readonly error_message?: ...; readonly type: ...; } | { readonly content: ...; readonly file_type: ...; readonly num_lines?: ...; readonly start_line?: ...; readonly total_lines?: ...; readonly type: ...; } | { readonly is_file_update: ...; readonly type: ...; } | { readonly lines?: ...; readonly new_lines?: ...; readonly new_start?: ...; readonly old_lines?: ...; readonly old_start?: ...; readonly type: ...; }; readonly tool_use_id: string; readonly type: "text_editor_code_execution_tool_result"; } | { readonly cache_control?: { readonly ttl?: ...; readonly type: ...; } | null; readonly content: { readonly error_code: ...; readonly error_message?: ...; readonly type: ...; } | { readonly tool_references: ...; readonly type: ...; }; readonly tool_use_id: string; readonly type: "tool_search_tool_result"; } | { readonly cache_control?: { readonly ttl?: ...; readonly type: ...; } | null; readonly id: string; readonly input: { [key: string]: Json; }; readonly name: string; readonly server_name: string; readonly type: "mcp_tool_use"; } | { readonly cache_control?: { readonly ttl?: ...; readonly type: ...; } | null; readonly content?: string | readonly Array<...>; readonly is_error?: boolean; readonly tool_use_id: string; readonly type: "mcp_tool_result"; } | { readonly cache_control?: { readonly ttl?: ...; readonly type: ...; } | null; readonly file_id: string; readonly type: "container_upload"; } | { readonly cache_control?: { readonly ttl?: ...; readonly type: ...; } | null; readonly content?: string | null; readonly encrypted_content?: string | null; readonly signature?: string | null; readonly tool_changes?: readonly Array<...> | null; readonly type: "compaction"; } | { readonly cache_control?: { readonly ttl?: ...; readonly type: ...; } | null; readonly tool: { readonly name: ...; readonly type: ...; } | { readonly name: ...; readonly server_name: ...; readonly type: ...; } | { readonly server_name: ...; readonly type: ...; } | { readonly definition: ...; readonly type: ...; }; readonly type: "tool_addition"; } | { readonly cache_control?: { readonly ttl?: ...; readonly type: ...; } | null; readonly tool: { readonly name: ...; readonly type: ...; } | { readonly name: ...; readonly server_name: ...; readonly type: ...; } | { readonly server_name: ...; readonly type: ...; }; readonly type: "tool_removal"; } | { readonly mcp_server_name: string; readonly tools: readonly Array<{ readonly description?: ...; readonly input_schema: ...; readonly name: ...; }>; readonly type: "mcp_tool_listing"; } | { readonly from: { readonly model: string; }; readonly to: { readonly model: string; }; readonly trigger?: Json; readonly type: "fallback"; }>; readonly output_config?: { readonly effort?: "low" | "medium" | "high" | "xhigh" | "max" | null; } | null; readonly role: "user" | "assistant" | "system"; }>; readonly metadata?: BetaMetadata; readonly model: string; readonly output_config?: BetaOutputConfig; readonly output_format?: { readonly schema: { [key: string]: Json; }; readonly type: "json_schema"; } | null; readonly service_tier?: "auto" | "standard_only"; readonly speed?: "standard" | "fast" | null; readonly stop_sequences?: readonly Array<string>; readonly stream?: boolean; readonly system?: string | readonly Array<{ readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly citations?: readonly Array<{ readonly cited_text: string; readonly document_index: number; readonly document_title: ... | ...; readonly end_char_index: number; readonly start_char_index: number; readonly type: "char_location"; } | { readonly cited_text: string; readonly document_index: number; readonly document_title: ... | ...; readonly end_page_number: number; readonly start_page_number: number; readonly type: "page_location"; } | { readonly cited_text: string; readonly document_index: number; readonly document_title: ... | ...; readonly end_block_index: number; readonly start_block_index: number; readonly type: "content_block_location"; } | { readonly cited_text: string; readonly encrypted_index: string; readonly title: ... | ...; readonly type: "web_search_result_location"; readonly url: string; } | { readonly cited_text: string; readonly end_block_index: number; readonly search_result_index: number; readonly source: string; readonly start_block_index: number; readonly title: ... | ...; readonly type: "search_result_location"; }> | null; readonly text: string; readonly type: "text"; }>; readonly temperature?: number; readonly thinking?: { readonly block_binding?: { readonly prefix_mismatch_behavior?: "error" | "drop_block" | null; } | null; readonly budget_tokens: number; readonly display?: "summarized" | "omitted" | "updates" | null; readonly type: "enabled"; } | { readonly type: "disabled"; } | { readonly type: "between_tools"; } | { readonly block_binding?: { readonly prefix_mismatch_behavior?: "error" | "drop_block" | null; } | null; readonly display?: "summarized" | "omitted" | "updates" | null; readonly type: "adaptive"; }; readonly tool_choice?: { readonly disable_parallel_tool_use?: boolean; readonly type: "auto"; } | { readonly disable_parallel_tool_use?: boolean; readonly type: "any"; } | { readonly disable_parallel_tool_use?: boolean; readonly name: string; readonly type: "tool"; } | { readonly type: "none"; }; readonly tools?: readonly Array<{ readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly defer_loading?: boolean; readonly description?: string; readonly eager_input_streaming?: boolean | null; readonly input_examples?: readonly Array<{ [key: string]: unknown; }>; readonly input_schema: BetaInputSchema; readonly name: string; readonly strict?: boolean; readonly type?: "custom" | null; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly defer_loading?: boolean; readonly input_examples?: readonly Array<{ [key: string]: unknown; }>; readonly name: "bash"; readonly strict?: boolean; readonly type: "bash_20241022"; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly defer_loading?: boolean; readonly input_examples?: readonly Array<{ [key: string]: unknown; }>; readonly name: "bash"; readonly strict?: boolean; readonly type: "bash_20250124"; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly defer_loading?: boolean; readonly name: "code_execution"; readonly strict?: boolean; readonly type: "code_execution_20250522"; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly defer_loading?: boolean; readonly name: "code_execution"; readonly strict?: boolean; readonly type: "code_execution_20250825"; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly defer_loading?: boolean; readonly name: "code_execution"; readonly strict?: boolean; readonly type: "code_execution_20260120"; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly defer_loading?: boolean; readonly name: "code_execution"; readonly strict?: boolean; readonly type: "code_execution_20260521"; } | { readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly configs?: { readonly close_tab?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly double_click?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly file_upload?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly find?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly form_input?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly get_page_text?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly hold_key?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly hover?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly javascript_exec?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly key?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly left_click?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly left_click_drag?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly left_mouse_down?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly left_mouse_up?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly list_tabs?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly middle_click?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly mouse_move?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly navigate?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly new_tab?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly read_console?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly read_network?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly read_page?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly right_click?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly screenshot?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly scroll?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly scroll_to?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly switch_tab?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly triple_click?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly type?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly wait?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly zoom?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; } | null; readonly type: "browser_toolset_20260801"; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly defer_loading?: boolean; readonly display_height_px: number; readonly display_number?: number | null; readonly display_width_px: number; readonly input_examples?: readonly Array<{ [key: string]: unknown; }>; readonly name: "computer"; readonly strict?: boolean; readonly type: "computer_20241022"; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly defer_loading?: boolean; readonly input_examples?: readonly Array<{ [key: string]: unknown; }>; readonly name: "memory"; readonly strict?: boolean; readonly type: "memory_20250818"; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly defer_loading?: boolean; readonly display_height_px: number; readonly display_number?: number | null; readonly display_width_px: number; readonly input_examples?: readonly Array<{ [key: string]: unknown; }>; readonly name: "computer"; readonly strict?: boolean; readonly type: "computer_20250124"; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly defer_loading?: boolean; readonly input_examples?: readonly Array<{ [key: string]: unknown; }>; readonly name: "str_replace_editor"; readonly strict?: boolean; readonly type: "text_editor_20241022"; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly defer_loading?: boolean; readonly display_height_px: number; readonly display_number?: number | null; readonly display_width_px: number; readonly enable_zoom?: boolean; readonly input_examples?: readonly Array<{ [key: string]: unknown; }>; readonly name: "computer"; readonly strict?: boolean; readonly type: "computer_20251124"; } | { readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly configs?: { readonly cursor_position?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly double_click?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly hold_key?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly key?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly left_click?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly left_click_drag?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly left_mouse_down?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly left_mouse_up?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly middle_click?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly mouse_move?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly right_click?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly screenshot?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly scroll?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly triple_click?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly type?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly wait?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; readonly zoom?: { readonly defer_loading?: ...; readonly enabled?: ...; } | null; } | null; readonly type: "computer_toolset_20260801"; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly defer_loading?: boolean; readonly input_examples?: readonly Array<{ [key: string]: unknown; }>; readonly name: "str_replace_editor"; readonly strict?: boolean; readonly type: "text_editor_20250124"; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly defer_loading?: boolean; readonly input_examples?: readonly Array<{ [key: string]: unknown; }>; readonly name: "str_replace_based_edit_tool"; readonly strict?: boolean; readonly type: "text_editor_20250429"; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly defer_loading?: boolean; readonly input_examples?: readonly Array<{ [key: string]: unknown; }>; readonly max_characters?: number | null; readonly name: "str_replace_based_edit_tool"; readonly strict?: boolean; readonly type: "text_editor_20250728"; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly allowed_domains?: readonly Array<string> | null; readonly blocked_domains?: readonly Array<string> | null; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly defer_loading?: boolean; readonly max_uses?: number | null; readonly name: "web_search"; readonly strict?: boolean; readonly type: "web_search_20250305"; readonly user_location?: { readonly city?: string | null; readonly country?: string | null; readonly region?: string | null; readonly timezone?: string | null; readonly type: "approximate"; } | null; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly allowed_domains?: readonly Array<string> | null; readonly blocked_domains?: readonly Array<string> | null; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly citations?: { readonly enabled?: boolean; } | null; readonly defer_loading?: boolean; readonly max_content_tokens?: number | null; readonly max_uses?: number | null; readonly name: "web_fetch"; readonly strict?: boolean; readonly type: "web_fetch_20250910"; readonly url_sources?: { readonly client_tool_results?: { readonly type: ...; } | { readonly type: ...; } | { readonly tools: ...; readonly type: ...; } | { readonly tools: ...; readonly type: ...; }; readonly server_tool_results?: { readonly type: ...; } | { readonly type: ...; } | { readonly tools: ...; readonly type: ...; } | { readonly tools: ...; readonly type: ...; }; readonly user_input?: { readonly type: ...; } | { readonly type: ...; }; } | null; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly allowed_domains?: readonly Array<string> | null; readonly blocked_domains?: readonly Array<string> | null; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly defer_loading?: boolean; readonly max_uses?: number | null; readonly name: "web_search"; readonly strict?: boolean; readonly type: "web_search_20260209"; readonly user_location?: { readonly city?: string | null; readonly country?: string | null; readonly region?: string | null; readonly timezone?: string | null; readonly type: "approximate"; } | null; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly allowed_domains?: readonly Array<string> | null; readonly blocked_domains?: readonly Array<string> | null; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly citations?: { readonly enabled?: boolean; } | null; readonly defer_loading?: boolean; readonly max_content_tokens?: number | null; readonly max_uses?: number | null; readonly name: "web_fetch"; readonly strict?: boolean; readonly type: "web_fetch_20260209"; readonly url_sources?: { readonly client_tool_results?: { readonly type: ...; } | { readonly type: ...; } | { readonly tools: ...; readonly type: ...; } | { readonly tools: ...; readonly type: ...; }; readonly server_tool_results?: { readonly type: ...; } | { readonly type: ...; } | { readonly tools: ...; readonly type: ...; } | { readonly tools: ...; readonly type: ...; }; readonly user_input?: { readonly type: ...; } | { readonly type: ...; }; } | null; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly allowed_domains?: readonly Array<string> | null; readonly blocked_domains?: readonly Array<string> | null; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly citations?: { readonly enabled?: boolean; } | null; readonly defer_loading?: boolean; readonly max_content_tokens?: number | null; readonly max_uses?: number | null; readonly name: "web_fetch"; readonly strict?: boolean; readonly type: "web_fetch_20260309"; readonly url_sources?: { readonly client_tool_results?: { readonly type: ...; } | { readonly type: ...; } | { readonly tools: ...; readonly type: ...; } | { readonly tools: ...; readonly type: ...; }; readonly server_tool_results?: { readonly type: ...; } | { readonly type: ...; } | { readonly tools: ...; readonly type: ...; } | { readonly tools: ...; readonly type: ...; }; readonly user_input?: { readonly type: ...; } | { readonly type: ...; }; } | null; readonly use_cache?: boolean; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly allowed_domains?: readonly Array<string> | null; readonly blocked_domains?: readonly Array<string> | null; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly defer_loading?: boolean; readonly max_uses?: number | null; readonly name: "web_search"; readonly response_inclusion?: "full" | "excluded"; readonly strict?: boolean; readonly type: "web_search_20260318"; readonly user_location?: { readonly city?: string | null; readonly country?: string | null; readonly region?: string | null; readonly timezone?: string | null; readonly type: "approximate"; } | null; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly allowed_domains?: readonly Array<string> | null; readonly blocked_domains?: readonly Array<string> | null; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly citations?: { readonly enabled?: boolean; } | null; readonly defer_loading?: boolean; readonly max_content_tokens?: number | null; readonly max_uses?: number | null; readonly name: "web_fetch"; readonly response_inclusion?: "full" | "excluded"; readonly strict?: boolean; readonly type: "web_fetch_20260318"; readonly url_sources?: { readonly client_tool_results?: { readonly type: ...; } | { readonly type: ...; } | { readonly tools: ...; readonly type: ...; } | { readonly tools: ...; readonly type: ...; }; readonly server_tool_results?: { readonly type: ...; } | { readonly type: ...; } | { readonly tools: ...; readonly type: ...; } | { readonly tools: ...; readonly type: ...; }; readonly user_input?: { readonly type: ...; } | { readonly type: ...; }; } | null; readonly use_cache?: boolean; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly caching?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly defer_loading?: boolean; readonly max_tokens?: number | null; readonly max_uses?: number | null; readonly model: string; readonly name: "advisor"; readonly strict?: boolean; readonly type: "advisor_20260301"; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly defer_loading?: boolean; readonly name: "tool_search_tool_bm25"; readonly strict?: boolean; readonly type: "tool_search_tool_bm25" | "tool_search_tool_bm25_20251119"; } | { readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120" | "code_execution_20260521">; readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly defer_loading?: boolean; readonly name: "tool_search_tool_regex"; readonly strict?: boolean; readonly type: "tool_search_tool_regex" | "tool_search_tool_regex_20251119"; } | { readonly cache_control?: { readonly ttl?: "5m" | "1h"; readonly type: "ephemeral"; } | null; readonly configs?: { [key: string]: { readonly defer_loading?: ... | ... | ...; readonly enabled?: ... | ... | ...; }; } | null; readonly default_config?: BetaMCPToolDefaultConfig; readonly mcp_server_name: string; readonly tools?: readonly Array<{ readonly description?: ... | ... | ...; readonly input_schema: { [key: ...]: ...; }; readonly name: string; }> | null; readonly type: "mcp_toolset"; }>; readonly top_k?: number; readonly top_p?: number; }; }) => Effect<[body: { readonly container?: { readonly expires_at: string; readonly id: string; readonly skills?: readonly Array<{ readonly skill_id: string; readonly type: "custom" | "anthropic"; readonly version: string; }> | null; } | null; readonly content: readonly Array<{ readonly citations?: readonly Array<{ readonly cited_text: ...; readonly document_index: ...; readonly document_title: ...; readonly end_char_index: ...; readonly file_id?: ...; readonly start_char_index: ...; readonly type: ...; } | { readonly cited_text: ...; readonly document_index: ...; readonly document_title: ...; readonly end_page_number: ...; readonly file_id?: ...; readonly start_page_number: ...; readonly type: ...; } | { readonly cited_text: ...; readonly document_index: ...; readonly document_title: ...; readonly end_block_index: ...; readonly file_id?: ...; readonly start_block_index: ...; readonly type: ...; } | { readonly cited_text: ...; readonly encrypted_index: ...; readonly title: ...; readonly type: ...; readonly url: ...; } | { readonly cited_text: ...; readonly end_block_index: ...; readonly search_result_index: ...; readonly source: ...; readonly start_block_index: ...; readonly title: ...; readonly type: ...; }> | null; readonly text: string; readonly type: "text"; } | { readonly signature: string; readonly thinking: string; readonly type: "thinking"; } | { readonly data: string; readonly type: "redacted_thinking"; } | { readonly caller?: { readonly type: "direct"; } | { readonly tool_id: string; readonly type: "code_execution_20250825"; } | { readonly tool_id: string; readonly type: "code_execution_20260120"; }; readonly id: string; readonly input: { [key: string]: Json; }; readonly name: string; readonly toolset_name?: string | null; readonly type: "tool_use"; } | { readonly caller?: { readonly type: "direct"; } | { readonly tool_id: string; readonly type: "code_execution_20250825"; } | { readonly tool_id: string; readonly type: "code_execution_20260120"; }; readonly id: string; readonly input: { [key: string]: Json; }; readonly name: "advisor" | "web_search" | "web_fetch" | "code_execution" | "bash_code_execution" | "text_editor_code_execution" | "tool_search_tool_regex" | "tool_search_tool_bm25"; readonly type: "server_tool_use"; } | { readonly caller?: { readonly type: "direct"; } | { readonly tool_id: string; readonly type: "code_execution_20250825"; } | { readonly tool_id: string; readonly type: "code_execution_20260120"; }; readonly content: { readonly error_code: "invalid_tool_input" | "unavailable" | "max_uses_exceeded" | "too_many_requests" | "query_too_long" | "request_too_large"; readonly type: "web_search_tool_result_error"; } | readonly Array<{ readonly encrypted_content: string; readonly page_age: ... | ...; readonly title: string; readonly type: "web_search_result"; readonly url: string; }>; readonly tool_use_id: string; readonly type: "web_search_tool_result"; } | { readonly caller?: { readonly type: "direct"; } | { readonly tool_id: string; readonly type: "code_execution_20250825"; } | { readonly tool_id: string; readonly type: "code_execution_20260120"; }; readonly content: { readonly error_code: "invalid_tool_input" | "unavailable" | "max_uses_exceeded" | "too_many_requests" | "url_too_long" | "url_not_allowed" | "url_not_in_prior_context" | "url_not_accessible" | "unsupported_content_type" | "content_too_large"; readonly type: "web_fetch_tool_result_error"; } | { readonly content: { readonly citations?: ... | ... | ...; readonly source: ... | ...; readonly title: ... | ...; readonly type: "document"; }; readonly retrieved_at: string | null; readonly type: "web_fetch_result"; readonly url: string; }; readonly tool_use_id: string; readonly type: "web_fetch_tool_result"; } | { readonly content: { readonly error_code: "unavailable" | "max_uses_exceeded" | "too_many_requests" | "prompt_too_long" | "overloaded" | "execution_time_exceeded" | "model_not_found"; readonly type: "advisor_tool_result_error"; } | { readonly stop_reason: string | null; readonly text: string; readonly type: "advisor_result"; } | { readonly encrypted_content: string; readonly stop_reason: string | null; readonly type: "advisor_redacted_result"; }; readonly tool_use_id: string; readonly type: "advisor_tool_result"; } | { readonly content: { readonly error_code: "invalid_tool_input" | "unavailable" | "too_many_requests" | "execution_time_exceeded"; readonly type: "code_execution_tool_result_error"; } | { readonly content: readonly Array<{ readonly file_id: ...; readonly type: ...; }>; readonly return_code: number; readonly stderr: string; readonly stdout: string; readonly type: "code_execution_result"; } | { readonly content: readonly Array<{ readonly file_id: ...; readonly type: ...; }>; readonly encrypted_stdout: string; readonly return_code: number; readonly stderr: string; readonly type: "encrypted_code_execution_result"; }; readonly tool_use_id: string; readonly type: "code_execution_tool_result"; } | { readonly content: { readonly error_code: "invalid_tool_input" | "unavailable" | "too_many_requests" | "execution_time_exceeded" | "output_file_too_large"; readonly type: "bash_code_execution_tool_result_error"; } | { readonly content: readonly Array<{ readonly file_id: ...; readonly type: ...; }>; readonly return_code: number; readonly stderr: string; readonly stdout: string; readonly type: "bash_code_execution_result"; }; readonly tool_use_id: string; readonly type: "bash_code_execution_tool_result"; } | { readonly content: { readonly error_code: "invalid_tool_input" | "unavailable" | "too_many_requests" | "execution_time_exceeded" | "file_not_found"; readonly error_message: string | null; readonly type: "text_editor_code_execution_tool_result_error"; } | { readonly content: string; readonly file_type: "text" | "image" | "pdf"; readonly num_lines: number | null; readonly start_line: number | null; readonly total_lines: number | null; readonly type: "text_editor_code_execution_view_result"; } | { readonly is_file_update: boolean; readonly type: "text_editor_code_execution_create_result"; } | { readonly lines: readonly Array<...> | null; readonly new_lines: number | null; readonly new_start: number | null; readonly old_lines: number | null; readonly old_start: number | null; readonly type: "text_editor_code_execution_str_replace_result"; }; readonly tool_use_id: string; readonly type: "text_editor_code_execution_tool_result"; } | { readonly content: { readonly error_code: "invalid_tool_input" | "unavailable" | "too_many_requests" | "execution_time_exceeded"; readonly error_message: string | null; readonly type: "tool_search_tool_result_error"; } | { readonly tool_references: readonly Array<{ readonly tool_name: ...; readonly type: ...; }>; readonly type: "tool_search_tool_search_result"; }; readonly tool_use_id: string; readonly type: "tool_search_tool_result"; } | { readonly id: string; readonly input: { [key: string]: Json; }; readonly name: string; readonly server_name: string; readonly type: "mcp_tool_use"; } | { readonly content: string | readonly Array<BetaResponseTextBlock>; readonly is_error: boolean; readonly tool_use_id: string; readonly type: "mcp_tool_result"; } | { readonly file_id: string; readonly type: "container_upload"; } | { readonly content: string | null; readonly encrypted_content?: string | null; readonly signature?: string | null; readonly tool_changes?: readonly Array<{ readonly tool: ...; readonly type: ...; } | { readonly tool: ...; readonly type: ...; }> | null; readonly type: "compaction"; } | { readonly from: BetaResponseFallbackHopInfo; readonly to: BetaResponseFallbackHopInfo; readonly trigger: BetaFallbackRefusalTrigger; readonly type: "fallback"; } | { readonly mcp_server_name: string; readonly tools: readonly Array<{ readonly description?: string; readonly input_schema: { [key: string]: unknown; }; readonly name: string; }>; readonly type: "mcp_tool_listing"; }>; readonly context_management?: { readonly applied_edits: readonly Array<{ readonly cleared_input_tokens: number; readonly cleared_tool_uses: number; readonly type: "clear_tool_uses_20250919"; } | { readonly cleared_input_tokens: number; readonly cleared_thinking_turns: number; readonly type: "clear_thinking_20251015"; }>; } | null; readonly diagnostics?: { readonly cache_miss_reason: { readonly cache_missed_input_tokens: number; readonly type: "model_changed"; } | { readonly cache_missed_input_tokens: number; readonly type: "system_changed"; } | { readonly cache_missed_input_tokens: number; readonly type: "tools_changed"; } | { readonly cache_missed_input_tokens: number; readonly type: "messages_changed"; } | { readonly type: "previous_message_not_found"; } | { readonly type: "unavailable"; } | null; } | null; readonly id: string; readonly input_transformations?: readonly Array<{ readonly path: string; readonly reason: "model_binding_mismatch" | "prefix_binding_mismatch" | "organization_binding_mismatch" | "end_user_binding_mismatch"; readonly type: "thinking_dropped"; } | { readonly path: string; readonly reason: "model_binding_mismatch" | "prefix_binding_mismatch" | "organization_binding_mismatch" | "end_user_binding_mismatch"; readonly type: "thinking_mismatch_allowed"; }> | null; readonly model: string; readonly role: "assistant"; readonly stop_details?: { readonly category: "cyber" | "bio" | "frontier_llm" | "reasoning_extraction" | "general_harms" | null; readonly explanation: string | null; readonly fallback_credit_token: string | null; readonly fallback_has_prefill_claim: boolean | null; readonly recommended_model: string | null; readonly type: "refusal"; } | null; readonly stop_reason: "max_tokens" | "compaction" | "tool_use" | "end_turn" | "stop_sequence" | "pause_turn" | "refusal" | "model_context_window_exceeded" | null; readonly stop_sequence: string | null; readonly type: "message"; readonly usage: BetaUsage; }, response: HttpClientResponse], AiError>; readonly createMessageStream: (options: { readonly params?: { readonly "anthropic-beta"?: string | readonly Array<string>; readonly "anthropic-user-profile-id"?: string; readonly "anthropic-version"?: string; readonly "anthropic-workspace-id"?: string; }; readonly payload: Omit<typeof Generated.BetaCreateMessageParams.Encoded, "stream">; }) => Effect<[response: HttpClientResponse, stream: Stream<MessageStreamEvent, AiError, never>], AiError>; readonly streamRequest: <S extends EventCodec>(schema: S) => (request: HttpClientRequest) => Stream<S["Type"], HttpClientError | SchemaError | Retry | SseError, S["DecodingServices"]>;}