Skip to content

AnthropicLanguageModel

The AnthropicLanguageModel module provides the Anthropic implementation of Effect AI's LanguageModel service. It translates Effect AI prompts, tools, files, reasoning content, and Anthropic-specific options into Messages API requests, then converts normal and streaming Anthropic responses back into Effect AI response content with provider metadata.

8 exports Added in v4.0.0 Source

Configuration

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

  • Config for available Anthropic request configuration fields

Signature

declare const withConfigOverride: {
  (overrides: {
    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<{
          readonly type: ...;
          readonly value: ...;
        }, "Encoded"> | null;
        readonly clear_tool_inputs?: boolean | readonly Array<string> | null;
        readonly exclude_tools?: readonly Array<string> | null;
        readonly keep?: ReadonlySide<{
          readonly type: ...;
          readonly value: ...;
        }, "Encoded">;
        readonly trigger?: ReadonlySide<{
          readonly type: ...;
          readonly value: ...;
        }, "Encoded"> | ReadonlySide<{
          readonly type: ...;
          readonly value: ...;
        }, "Encoded">;
        readonly type: "clear_tool_uses_20250919";
      } | {
        readonly keep?: "all" | ReadonlySide<{
          readonly type: ...;
          readonly value: ...;
        }, "Encoded"> | ReadonlySide<{
          readonly type: ...;
        }, "Encoded">;
        readonly type: "clear_thinking_20251015";
      } | {
        readonly instructions?: string | null;
        readonly pause_after_compaction?: boolean;
        readonly trigger?: ReadonlySide<{
          readonly type: ...;
          readonly value: ...;
        }, "Encoded"> | null;
        readonly type: "compact_20260112";
      }>;
    } | null;
    readonly disableParallelToolCalls?: boolean;
    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 metadata?: {
      readonly user_id?: string | null;
    };
    readonly model?: string;
    readonly output_config?: {
      readonly effort?: "low" | "medium" | "high" | 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 strictJsonSchema?: 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: String;
        readonly document_index: Number;
        readonly document_title: Union<...>;
        readonly end_char_index: Number;
        readonly start_char_index: Number;
        readonly type: Literal<...>;
      }, "Encoded"> | ReadonlySide<{
        readonly cited_text: String;
        readonly document_index: Number;
        readonly document_title: Union<...>;
        readonly end_page_number: Number;
        readonly start_page_number: Number;
        readonly type: Literal<...>;
      }, "Encoded"> | ReadonlySide<{
        readonly cited_text: String;
        readonly document_index: Number;
        readonly document_title: Union<...>;
        readonly end_block_index: Number;
        readonly start_block_index: Number;
        readonly type: Literal<...>;
      }, "Encoded"> | ReadonlySide<{
        readonly cited_text: String;
        readonly encrypted_index: String;
        readonly title: Union<...>;
        readonly type: Literal<...>;
        readonly url: String;
      }, "Encoded"> | ReadonlySide<{
        readonly cited_text: String;
        readonly end_block_index: Number;
        readonly search_result_index: Number;
        readonly source: String;
        readonly start_block_index: Number;
        readonly title: Union<...>;
        readonly type: Literal<...>;
      }, "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 top_k?: number;
    readonly top_p?: number;
  }): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, Config>>;
  <A, E, R>(self: Effect<A, E, R>, overrides: {
    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<{
          readonly type: ...;
          readonly value: ...;
        }, "Encoded"> | null;
        readonly clear_tool_inputs?: boolean | readonly Array<string> | null;
        readonly exclude_tools?: readonly Array<string> | null;
        readonly keep?: ReadonlySide<{
          readonly type: ...;
          readonly value: ...;
        }, "Encoded">;
        readonly trigger?: ReadonlySide<{
          readonly type: ...;
          readonly value: ...;
        }, "Encoded"> | ReadonlySide<{
          readonly type: ...;
          readonly value: ...;
        }, "Encoded">;
        readonly type: "clear_tool_uses_20250919";
      } | {
        readonly keep?: "all" | ReadonlySide<{
          readonly type: ...;
          readonly value: ...;
        }, "Encoded"> | ReadonlySide<{
          readonly type: ...;
        }, "Encoded">;
        readonly type: "clear_thinking_20251015";
      } | {
        readonly instructions?: string | null;
        readonly pause_after_compaction?: boolean;
        readonly trigger?: ReadonlySide<{
          readonly type: ...;
          readonly value: ...;
        }, "Encoded"> | null;
        readonly type: "compact_20260112";
      }>;
    } | null;
    readonly disableParallelToolCalls?: boolean;
    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 metadata?: {
      readonly user_id?: string | null;
    };
    readonly model?: string;
    readonly output_config?: {
      readonly effort?: "low" | "medium" | "high" | 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 strictJsonSchema?: 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: String;
        readonly document_index: Number;
        readonly document_title: Union<...>;
        readonly end_char_index: Number;
        readonly start_char_index: Number;
        readonly type: Literal<...>;
      }, "Encoded"> | ReadonlySide<{
        readonly cited_text: String;
        readonly document_index: Number;
        readonly document_title: Union<...>;
        readonly end_page_number: Number;
        readonly start_page_number: Number;
        readonly type: Literal<...>;
      }, "Encoded"> | ReadonlySide<{
        readonly cited_text: String;
        readonly document_index: Number;
        readonly document_title: Union<...>;
        readonly end_block_index: Number;
        readonly start_block_index: Number;
        readonly type: Literal<...>;
      }, "Encoded"> | ReadonlySide<{
        readonly cited_text: String;
        readonly encrypted_index: String;
        readonly title: Union<...>;
        readonly type: Literal<...>;
        readonly url: String;
      }, "Encoded"> | ReadonlySide<{
        readonly cited_text: String;
        readonly end_block_index: Number;
        readonly search_result_index: Number;
        readonly source: String;
        readonly start_block_index: Number;
        readonly title: Union<...>;
        readonly type: Literal<...>;
      }, "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 top_k?: number;
    readonly top_p?: number;
  }): Effect<A, E, Exclude<R, Config>>;
}

Constructors

make

Added in v4.0.0 Source

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

  • layer for providing the service as a Layer
  • model for creating a model descriptor for AiModel.provide

Signature

declare const make: (...args: [{
  readonly config?: Omit<{
    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: ...;
        readonly type: ...;
        readonly version?: ...;
      }> | null;
    } | null;
    readonly context_management?: {
      readonly edits?: readonly Array<... | ... | ...>;
    } | null;
    readonly disableParallelToolCalls?: boolean;
    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 enabled?: ...;
      } | null;
      readonly type: "url";
      readonly url: string;
    }>;
    readonly metadata?: {
      readonly user_id?: string | null;
    };
    readonly model?: string;
    readonly output_config?: {
      readonly effort?: "low" | "medium" | "high" | null;
    };
    readonly output_format?: ReadonlySide<{
      readonly schema: $Record<String, Codec<..., ..., ..., ...>>;
      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 strictJsonSchema?: boolean;
    readonly system?: string | readonly Array<{
      readonly cache_control?: {
        readonly ttl?: ...;
        readonly type: ...;
      } | null;
      readonly citations?: readonly Array<...> | 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 top_k?: number;
    readonly top_p?: number;
  }, "model">;
  readonly model: "claude-sonnet-5" | "claude-fable-5" | "claude-mythos-5" | "claude-opus-4-8" | "claude-opus-4-7" | "claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | "claude-haiku-4-5-20251001" | "claude-opus-4-5" | "claude-opus-4-5-20251101" | "claude-sonnet-4-5" | "claude-sonnet-4-5-20250929" | "claude-opus-4-1" | "claude-opus-4-1-20250805" | string & {};
}]) => Effect<Service, never, AnthropicClient>

model

Added in v4.0.0 Source

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

  • layer for creating a LanguageModel.LanguageModel layer directly
  • make for constructing the language model service effectfully

Signature

declare function model(model: "claude-sonnet-5" | "claude-fable-5" | "claude-mythos-5" | "claude-opus-4-8" | "claude-opus-4-7" | "claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | "claude-haiku-4-5-20251001" | "claude-opus-4-5" | "claude-opus-4-5-20251101" | "claude-sonnet-4-5" | "claude-sonnet-4-5-20250929" | "claude-opus-4-1" | "claude-opus-4-1-20250805" | string & {}, config?: Omit<{
  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 disableParallelToolCalls?: boolean;
  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 metadata?: {
    readonly user_id?: string | null;
  };
  readonly model?: string;
  readonly output_config?: {
    readonly effort?: "low" | "medium" | "high" | 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 strictJsonSchema?: 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 top_k?: number;
  readonly top_p?: number;
}, "model">): Model<"anthropic", LanguageModel, AnthropicClient>

Layers

layer

Added in v4.0.0 Source

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

  • make for constructing the language model service effectfully
  • model for creating a model service directly

Signature

declare function layer(options: {
  readonly config?: Omit<{
    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?: ... | ... | ...;
        readonly clear_tool_inputs?: ... | ... | ... | ... | ...;
        readonly exclude_tools?: ... | ... | ...;
        readonly keep?: ... | ...;
        readonly trigger?: ... | ... | ...;
        readonly type: "clear_tool_uses_20250919";
      } | {
        readonly keep?: ... | ... | ... | ...;
        readonly type: "clear_thinking_20251015";
      } | {
        readonly instructions?: ... | ... | ...;
        readonly pause_after_compaction?: ... | ... | ...;
        readonly trigger?: ... | ... | ...;
        readonly type: "compact_20260112";
      }>;
    } | null;
    readonly disableParallelToolCalls?: boolean;
    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<...> | null;
        readonly enabled?: boolean | null;
      } | null;
      readonly type: "url";
      readonly url: string;
    }>;
    readonly metadata?: {
      readonly user_id?: string | null;
    };
    readonly model?: string;
    readonly output_config?: {
      readonly effort?: "low" | "medium" | "high" | 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 strictJsonSchema?: boolean;
    readonly system?: string | readonly Array<{
      readonly cache_control?: {
        readonly ttl?: "5m" | "1h";
        readonly type: "ephemeral";
      } | null;
      readonly citations?: readonly Array<ReadonlySide<..., ...> | ReadonlySide<..., ...> | ReadonlySide<..., ...> | ReadonlySide<..., ...> | ReadonlySide<..., ...>> | 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 top_k?: number;
    readonly top_p?: number;
  }, "model">;
  readonly model: "claude-sonnet-5" | "claude-fable-5" | "claude-mythos-5" | "claude-opus-4-8" | "claude-opus-4-7" | "claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | "claude-haiku-4-5-20251001" | "claude-opus-4-5" | "claude-opus-4-5-20251101" | "claude-sonnet-4-5" | "claude-sonnet-4-5-20250929" | "claude-opus-4-1" | "claude-opus-4-1-20250805" | string & {};
}): Layer<LanguageModel, never, AnthropicClient>

Models

Model type

Added in v4.0.0 Source

Known Anthropic Claude model identifiers exposed by the generated Anthropic schema.

Signature

type Model = (typeof Generated.Model)["members"][1]["Encoded"];

Services

Config

Added in v4.0.0 Source

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 Config extends Shape<"@effect/ai-anthropic/AnthropicLanguageModel/Config", {
  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 disableParallelToolCalls?: boolean;
  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 metadata?: {
    readonly user_id?: string | null;
  };
  readonly model?: string;
  readonly output_config?: {
    readonly effort?: "low" | "medium" | "high" | 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 strictJsonSchema?: 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 top_k?: number;
  readonly top_p?: number;
}, this> {
  constructor(_: never);
}

Tools

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.Encoded;

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

Signature

type AnthropicUserDefinedTool = typeof Generated.BetaTool.Encoded;