AnthropicLanguageModel.ts
AnthropicLanguageModel.ts overview
Section titled “AnthropicLanguageModel.ts overview”Exports Grouped by Category
Section titled “Exports Grouped by Category”configuration
Section titled “configuration”Config (class)
Section titled “Config (class)”Context service for Anthropic language model configuration.
When to use
Use when you need scoped Anthropic model request defaults or per-operation overrides from Effect context.
Details
The service stores request fields that are merged into Anthropic Messages API
requests. Scoped configuration overrides defaults supplied to model,
make, or layer.
Signature
declare class ConfigSince v4.0.0
withConfigOverride
Section titled “withConfigOverride”Provides config overrides for Anthropic language model operations.
When to use
Use to apply Anthropic request configuration to one effect without changing the model’s default configuration.
Details
The overrides are merged with any existing Config service for the duration
of the supplied effect. Fields in overrides take precedence over existing
config, and the helper supports both effect.pipe(withConfigOverride(overrides))
and withConfigOverride(effect, overrides).
See
Configfor available Anthropic request configuration fields
Signature
declare const withConfigOverride: { (overrides: typeof Config.Service): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Config>> <A, E, R>(self: Effect.Effect<A, E, R>, overrides: typeof Config.Service): Effect.Effect<A, E, Exclude<R, Config>>}Since v4.0.0
constructors
Section titled “constructors”Creates an Anthropic LanguageModel service from a model identifier and optional request defaults.
When to use
Use when you need to construct a LanguageModel.Service value backed by
AnthropicClient inside an Effect.
Details
The returned effect requires AnthropicClient. Request defaults from the
config option are merged with any Config service in the context, with
context values taking precedence.
See
layerfor providing the service as aLayermodelfor creating a model descriptor forAiModel.provide
Signature
declare const make: (args_0: { readonly model: (string & {}) | Model readonly config?: Omit<typeof Config.Service, "model"> | undefined}) => Effect.Effect<LanguageModel.Service, never, AnthropicClient>Since v4.0.0
Creates an Anthropic model descriptor that can be provided with Effect.provide.
When to use
Use when you want an Anthropic Claude model value that carries provider and model metadata and can be supplied directly to an Effect program.
See
layerfor creating aLanguageModel.LanguageModellayer directlymakefor constructing the language model service effectfully
Signature
declare const model: ( model: (string & {}) | Model, config?: Omit<typeof Config.Service, "model">) => AiModel.Model<"anthropic", LanguageModel.LanguageModel, AnthropicClient>Since v4.0.0
layers
Section titled “layers”Creates a layer for the Anthropic language model.
When to use
Use when composing application layers and you want Anthropic to satisfy
LanguageModel.LanguageModel while supplying AnthropicClient from another
layer.
See
makefor constructing the language model service effectfullymodelfor creating a model service directly
Signature
declare const layer: (options: { readonly model: (string & {}) | Model readonly config?: Omit<typeof Config.Service, "model"> | undefined}) => Layer.Layer<LanguageModel.LanguageModel, never, AnthropicClient>Since v4.0.0
models
Section titled “models”Model (type alias)
Section titled “Model (type alias)”Known Anthropic Claude model identifiers exposed by the generated Anthropic schema.
Details
The Anthropic language model constructors accept Model values and custom
string model ids, so this type is best used for autocomplete and type checking
of known Claude ids.
Signature
type Model = typeof Generated.Model.TypeSince v4.0.0
AnthropicProviderDefinedTool (type alias)
Section titled “AnthropicProviderDefinedTool (type alias)”Represents a provider-defined tool that can be passed to the Anthropic API.
Details
These include Anthropic’s built-in tools like computer use, code execution, web search, and text editing.
Signature
type AnthropicProviderDefinedTool = | typeof Generated.BetaBashTool_20241022.Encoded | typeof Generated.BetaBashTool_20250124.Encoded | typeof Generated.BetaCodeExecutionTool_20250522.Encoded | typeof Generated.BetaCodeExecutionTool_20250825.Encoded | typeof Generated.BetaComputerUseTool_20241022.Encoded | typeof Generated.BetaComputerUseTool_20250124.Encoded | typeof Generated.BetaComputerUseTool_20251124.Encoded | typeof Generated.BetaMemoryTool_20250818.Encoded | typeof Generated.BetaTextEditor_20241022.Encoded | typeof Generated.BetaTextEditor_20250124.Encoded | typeof Generated.BetaTextEditor_20250429.Encoded | typeof Generated.BetaTextEditor_20250728.Encoded | typeof Generated.BetaToolSearchToolBM25_20251119.Encoded | typeof Generated.BetaToolSearchToolRegex_20251119.Encoded | typeof Generated.BetaWebFetchTool_20250910.Encoded | typeof Generated.BetaWebSearchTool_20250305.EncodedSince v4.0.0
AnthropicUserDefinedTool (type alias)
Section titled “AnthropicUserDefinedTool (type alias)”Encoded Anthropic custom tool definition that can be sent in a Messages API request.
When to use
Use when you need to type or inspect the provider-specific request payload for a custom Anthropic tool.
Details
This type aliases the encoded Generated.BetaTool schema used for Effect
user-defined and dynamic tools after conversion. It contains the tool name,
optional description, and input_schema, plus Anthropic-specific fields
such as strict and cache_control.
See
AnthropicProviderDefinedToolfor the request shape used by Anthropic built-in provider tools
Signature
type AnthropicUserDefinedTool = typeof Generated.BetaTool.EncodedSince v4.0.0