Skip to content

AnthropicClient

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.

7 exports Added in v4.0.0 Source

Constructors

make

Added in v4.0.0 Source

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 Layer from explicit options
  • layerConfig for providing the client as a Layer with Config-based settings

Signature

declare const make: (...args: [options: Options]) => Effect;

Layers

layer

Added in v4.0.0 Source

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

Added in v4.0.0 Source

Creates 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

  • layer for providing the client from explicit options instead of Config
  • make for constructing the client service effectfully

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

MessageStreamEvent type

Added in v4.0.0 Source

Represents an event received from the Anthropic Messages API during a streaming request.

Details

Events include: - message_start: Initial event containing message metadata - message_delta: Incremental updates to the message (e.g., stop reason) - message_stop: Final event indicating the message is complete - content_block_start: Start of a content block - content_block_delta: Incremental content updates (text, tool use, etc.) - content_block_stop: End of a content block - error: 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.Type;

Options

Options type

Added in v4.0.0 Source

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

Service 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);
}

Service interface

Added in v4.0.0 Source

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 "anthropic-version"?: string;
};
readonly payload: {
readonly cache_control?: {
readonly ttl?: "5m" | "1h";
readonly type: "ephemeral";
} | null;
readonly container?: string | {
readonly id?: string | null;
readonly skills?: readonly Array<{
readonly skill_id: string;
readonly type: "anthropic" | "custom";
readonly version?: string;
}> | null;
} | null;
readonly context_management?: {
readonly edits?: readonly Array<{
readonly clear_at_least?: ReadonlySide<..., ...> | null;
readonly clear_tool_inputs?: boolean | readonly Array<...> | null;
readonly exclude_tools?: readonly Array<...> | null;
readonly keep?: ReadonlySide<..., ...>;
readonly trigger?: ReadonlySide<..., ...> | ReadonlySide<..., ...>;
readonly type: "clear_tool_uses_20250919";
} | {
readonly keep?: "all" | ReadonlySide<..., ...> | ReadonlySide<..., ...>;
readonly type: "clear_thinking_20251015";
} | {
readonly instructions?: string | null;
readonly pause_after_compaction?: boolean;
readonly trigger?: ReadonlySide<..., ...> | null;
readonly type: "compact_20260112";
}>;
} | 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<ReadonlySide<{
readonly content: Union<readonly [String, $Array<Union<readonly [..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ...]>>]>;
readonly role: Literals<readonly ["user", "assistant"]>;
}, "Encoded">>;
readonly metadata?: {
readonly user_id?: string | null;
};
readonly model: string;
readonly output_config?: {
readonly effort?: "low" | "medium" | "high" | "max" | null;
readonly format?: ReadonlySide<{
readonly schema: $Record<String, Codec<Json, Json, never, never>>;
readonly type: Literal<"json_schema">;
}, "Encoded"> | null;
};
readonly output_format?: ReadonlySide<{
readonly schema: $Record<String, Codec<Json, Json, never, never>>;
readonly type: Literal<"json_schema">;
}, "Encoded"> | 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<ReadonlySide<{
readonly cited_text: ...;
readonly document_index: ...;
readonly document_title: ...;
readonly end_char_index: ...;
readonly start_char_index: ...;
readonly type: ...;
}, "Encoded"> | ReadonlySide<{
readonly cited_text: ...;
readonly document_index: ...;
readonly document_title: ...;
readonly end_page_number: ...;
readonly start_page_number: ...;
readonly type: ...;
}, "Encoded"> | ReadonlySide<{
readonly cited_text: ...;
readonly document_index: ...;
readonly document_title: ...;
readonly end_block_index: ...;
readonly start_block_index: ...;
readonly type: ...;
}, "Encoded"> | ReadonlySide<{
readonly cited_text: ...;
readonly encrypted_index: ...;
readonly title: ...;
readonly type: ...;
readonly url: ...;
}, "Encoded"> | ReadonlySide<{
readonly cited_text: ...;
readonly end_block_index: ...;
readonly search_result_index: ...;
readonly source: ...;
readonly start_block_index: ...;
readonly title: ...;
readonly type: ...;
}, "Encoded">> | null;
readonly text: string;
readonly type: "text";
}>;
readonly temperature?: number;
readonly thinking?: ReadonlySide<{
readonly budget_tokens: Number;
readonly type: Literal<"enabled">;
}, "Encoded"> | ReadonlySide<{
readonly type: Literal<"disabled">;
}, "Encoded"> | ReadonlySide<{
readonly type: Literal<"adaptive">;
}, "Encoded">;
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";
} | ReadonlySide<{
readonly type: Literal<"none">;
}, "Encoded">;
readonly tools?: readonly Array<{
readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120">;
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: {
[key: string]: Json;
readonly properties?: {
[key: string]: Json;
} | null;
readonly required?: readonly Array<string> | null;
readonly type: "object";
};
readonly name: string;
readonly strict?: boolean;
readonly type?: "custom" | null;
} | {
readonly allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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 allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120">;
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">;
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">;
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">;
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">;
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 allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120">;
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">;
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 allowed_callers?: readonly Array<"direct" | "code_execution_20250825" | "code_execution_20260120">;
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">;
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?: {
readonly defer_loading?: boolean;
readonly enabled?: boolean;
};
readonly mcp_server_name: string;
readonly type: "mcp_toolset";
}>;
readonly top_k?: number;
readonly top_p?: number;
};
}) => Effect<[body: {
readonly container?: ReadonlySide<{
readonly expires_at: String;
readonly id: String;
readonly skills: Union<readonly [$Array<Struct<...>>, Null]>;
}, "Type"> | null;
readonly content: readonly Array<{
readonly citations?: readonly Array<ReadonlySide<..., ...> | ReadonlySide<..., ...> | ReadonlySide<..., ...> | ReadonlySide<..., ...> | ReadonlySide<..., ...>> | null;
readonly text: string;
readonly type: "text";
} | ReadonlySide<{
readonly signature: String;
readonly thinking: String;
readonly type: Literal<"thinking">;
}, "Type"> | ReadonlySide<{
readonly data: String;
readonly type: Literal<"redacted_thinking">;
}, "Type"> | {
readonly caller?: ReadonlySide<{
readonly type: Literal<...>;
}, "Type"> | ReadonlySide<{
readonly tool_id: String;
readonly type: Literal<...>;
}, "Type"> | ReadonlySide<{
readonly tool_id: String;
readonly type: Literal<...>;
}, "Type">;
readonly id: string;
readonly input: {
[key: string]: Json;
};
readonly name: string;
readonly type: "tool_use";
} | {
readonly caller?: ReadonlySide<{
readonly type: Literal<...>;
}, "Type"> | ReadonlySide<{
readonly tool_id: String;
readonly type: Literal<...>;
}, "Type"> | ReadonlySide<{
readonly tool_id: String;
readonly type: Literal<...>;
}, "Type">;
readonly id: string;
readonly input: {
[key: string]: Json;
};
readonly name: "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?: ReadonlySide<{
readonly type: Literal<...>;
}, "Type"> | ReadonlySide<{
readonly tool_id: String;
readonly type: Literal<...>;
}, "Type"> | ReadonlySide<{
readonly tool_id: String;
readonly type: Literal<...>;
}, "Type">;
readonly content: ReadonlySide<{
readonly error_code: Literals<...>;
readonly type: Literal<...>;
}, "Type"> | readonly Array<ReadonlySide<{
readonly encrypted_content: ...;
readonly page_age: ...;
readonly title: ...;
readonly type: ...;
readonly url: ...;
}, "Type">>;
readonly tool_use_id: string;
readonly type: "web_search_tool_result";
} | {
readonly caller?: ReadonlySide<{
readonly type: Literal<...>;
}, "Type"> | ReadonlySide<{
readonly tool_id: String;
readonly type: Literal<...>;
}, "Type"> | ReadonlySide<{
readonly tool_id: String;
readonly type: Literal<...>;
}, "Type">;
readonly content: ReadonlySide<{
readonly error_code: Literals<...>;
readonly type: Literal<...>;
}, "Type"> | ReadonlySide<{
readonly content: Struct<...>;
readonly retrieved_at: Union<...>;
readonly type: Literal<...>;
readonly url: String;
}, "Type">;
readonly tool_use_id: string;
readonly type: "web_fetch_tool_result";
} | ReadonlySide<{
readonly content: Union<readonly [Struct<...>, Struct<...>, Struct<...>]>;
readonly tool_use_id: String;
readonly type: Literal<"code_execution_tool_result">;
}, "Type"> | ReadonlySide<{
readonly content: Union<readonly [Struct<...>, Struct<...>]>;
readonly tool_use_id: String;
readonly type: Literal<"bash_code_execution_tool_result">;
}, "Type"> | ReadonlySide<{
readonly content: Union<readonly [Struct<...>, Struct<...>, Struct<...>, Struct<...>]>;
readonly tool_use_id: String;
readonly type: Literal<"text_editor_code_execution_tool_result">;
}, "Type"> | ReadonlySide<{
readonly content: Union<readonly [Struct<...>, Struct<...>]>;
readonly tool_use_id: String;
readonly type: Literal<"tool_search_tool_result">;
}, "Type"> | ReadonlySide<{
readonly id: String;
readonly input: $Record<String, Codec<Json, Json, never, never>>;
readonly name: String;
readonly server_name: String;
readonly type: Literal<"mcp_tool_use">;
}, "Type"> | ReadonlySide<{
readonly content: Union<readonly [String, $Array<...>]>;
readonly is_error: Boolean;
readonly tool_use_id: String;
readonly type: Literal<"mcp_tool_result">;
}, "Type"> | ReadonlySide<{
readonly file_id: String;
readonly type: Literal<"container_upload">;
}, "Type"> | ReadonlySide<{
readonly content: Union<readonly [String, Null]>;
readonly type: Literal<"compaction">;
}, "Type">>;
readonly context_management?: ReadonlySide<{
readonly applied_edits: $Array<Union<readonly [Struct<...>, Struct<...>]>>;
}, "Type"> | null;
readonly id: string;
readonly model: string;
readonly role: "assistant";
readonly stop_reason: "tool_use" | "compaction" | "max_tokens" | "end_turn" | "stop_sequence" | "pause_turn" | "refusal" | "model_context_window_exceeded" | null;
readonly stop_sequence: string | null;
readonly type: "message";
readonly usage: {
readonly cache_creation: ReadonlySide<{
readonly ephemeral_1h_input_tokens: Number;
readonly ephemeral_5m_input_tokens: Number;
}, "Type"> | null;
readonly cache_creation_input_tokens: number | null;
readonly cache_read_input_tokens: number | null;
readonly inference_geo: string | null;
readonly input_tokens: number;
readonly iterations?: readonly Array<ReadonlySide<{
readonly cache_creation: Union<...>;
readonly cache_creation_input_tokens: Number;
readonly cache_read_input_tokens: Number;
readonly input_tokens: Number;
readonly output_tokens: Number;
readonly type: Literal<...>;
}, "Type"> | ReadonlySide<{
readonly cache_creation: Union<...>;
readonly cache_creation_input_tokens: Number;
readonly cache_read_input_tokens: Number;
readonly input_tokens: Number;
readonly output_tokens: Number;
readonly type: Literal<...>;
}, "Type">> | null;
readonly output_tokens: number;
readonly server_tool_use?: ReadonlySide<{
readonly web_fetch_requests: Number;
readonly web_search_requests: Number;
}, "Type"> | null;
readonly service_tier: "standard" | "priority" | "batch" | null;
readonly speed?: "standard" | "fast" | null;
};
}, response: HttpClientResponse], AiError>;
readonly createMessageStream: (options: {
readonly params?: {
readonly "anthropic-beta"?: string;
readonly "anthropic-version"?: 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"], any, S["DecodingServices"]>;
}